From 67bc35e882800164c2a7a30cadc237d4051a4b46 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 23 Nov 2020 16:19:26 +0000 Subject: [PATCH] Fix logic for comparisons of struct #raw_union types --- core/reflect/reflect.odin | 3 ++- src/types.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/reflect/reflect.odin b/core/reflect/reflect.odin index df183e2fd..ed50d658b 100644 --- a/core/reflect/reflect.odin +++ b/core/reflect/reflect.odin @@ -1207,7 +1207,7 @@ as_raw_data :: proc(a: any) -> (value: rawptr, valid: bool) { return; } - +/* not_equal :: proc(a, b: any) -> bool { return !equal(a, b); } @@ -1284,3 +1284,4 @@ equal :: proc(a, b: any) -> bool { return true; } +*/ diff --git a/src/types.cpp b/src/types.cpp index b8b4b32f5..0fc529213 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1919,6 +1919,9 @@ bool is_type_comparable(Type *t) { return is_type_comparable(t->Opaque.elem); case Type_Struct: + if (t->Struct.is_raw_union) { + return is_type_simple_compare(t); + } for_array(i, t->Struct.fields) { Entity *f = t->Struct.fields[i]; if (!is_type_comparable(f->type)) {