Explorar o código

Fixed struct ptr null test. Fixes #530.

Brucey %!s(int64=4) %!d(string=hai) anos
pai
achega
38a7cc8d21
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      expr.bmx

+ 6 - 2
expr.bmx

@@ -2219,14 +2219,18 @@ Type TBinaryCompareExpr Extends TBinaryExpr
 				If op = "=" Then
 				If op = "=" Then
 					ty=New TBoolType
 					ty=New TBoolType
 					exprType=New TBoolType
 					exprType=New TBoolType
-					lhs = New TConstExpr.Create(New TIntType, 1).Semant()
+					If Not IsPointerType(lhs.exprType, 0, TType.T_POINTER) Then
+						lhs = New TConstExpr.Create(New TIntType, 1).Semant()
+					End If
 					rhs = New TConstExpr.Create(New TIntType, 0).Semant()
 					rhs = New TConstExpr.Create(New TIntType, 0).Semant()
 					Return Self
 					Return Self
 				Else
 				Else
 					op = "<>"
 					op = "<>"
 					ty = New TBoolType
 					ty = New TBoolType
 					exprType=New TBoolType
 					exprType=New TBoolType
-					lhs = New TConstExpr.Create(New TIntType, 1).Semant()
+					If Not IsPointerType(lhs.exprType, 0, TType.T_POINTER) Then
+						lhs = New TConstExpr.Create(New TIntType, 1).Semant()
+					End If
 					rhs = New TConstExpr.Create(New TIntType, 0).Semant()
 					rhs = New TConstExpr.Create(New TIntType, 0).Semant()
 					Return Self
 					Return Self
 				End If
 				End If