Browse Source

Fix logic for comparisons of struct #raw_union types

gingerBill 4 years ago
parent
commit
67bc35e882
2 changed files with 5 additions and 1 deletions
  1. 2 1
      core/reflect/reflect.odin
  2. 3 0
      src/types.cpp

+ 2 - 1
core/reflect/reflect.odin

@@ -1207,7 +1207,7 @@ as_raw_data :: proc(a: any) -> (value: rawptr, valid: bool) {
 	return;
 	return;
 }
 }
 
 
-
+/*
 not_equal :: proc(a, b: any) -> bool {
 not_equal :: proc(a, b: any) -> bool {
 	return !equal(a, b);
 	return !equal(a, b);
 }
 }
@@ -1284,3 +1284,4 @@ equal :: proc(a, b: any) -> bool {
 
 
 	return true;
 	return true;
 }
 }
+*/

+ 3 - 0
src/types.cpp

@@ -1919,6 +1919,9 @@ bool is_type_comparable(Type *t) {
 		return is_type_comparable(t->Opaque.elem);
 		return is_type_comparable(t->Opaque.elem);
 
 
 	case Type_Struct:
 	case Type_Struct:
+		if (t->Struct.is_raw_union) {
+			return is_type_simple_compare(t);
+		}
 		for_array(i, t->Struct.fields) {
 		for_array(i, t->Struct.fields) {
 			Entity *f = t->Struct.fields[i];
 			Entity *f = t->Struct.fields[i];
 			if (!is_type_comparable(f->type)) {
 			if (!is_type_comparable(f->type)) {