浏览代码

Fixed struct ptr null test. Fixes #530.

Brucey 4 年之前
父节点
当前提交
38a7cc8d21
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      expr.bmx

+ 6 - 2
expr.bmx

@@ -2219,14 +2219,18 @@ Type TBinaryCompareExpr Extends TBinaryExpr
 				If op = "=" Then
 					ty=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()
 					Return Self
 				Else
 					op = "<>"
 					ty = 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()
 					Return Self
 				End If