Переглянути джерело

Structs can only be compared using an appropriate overload. Fixes #434.

woollybah 6 роки тому
батько
коміт
b8dd2396b2
1 змінених файлів з 5 додано та 1 видалено
  1. 5 1
      expr.bmx

+ 5 - 1
expr.bmx

@@ -2015,7 +2015,11 @@ Type TBinaryCompareExpr Extends TBinaryExpr
 					Return New TInvokeMemberExpr.Create( lhs, decl, args ).Semant()
 				End If
 			Catch error:String
-				' no overload, continue...
+				' Structs must define an operator overload for the given op
+				If TObjectType(lhs.exprType).classDecl.IsStruct() Then
+					Err "No overloaded operator '" + op + "' found for " + TObjectType(lhs.exprType).classDecl.ToString()
+				End If
+				' otherwise, no overload, continue...
 			End Try
 		End If