aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-11-10 17:55:16 +0100
committerAndrew Kelley <andrew@ziglang.org>2020-11-10 17:21:49 -0500
commit4d4ab1e69a40fb11d19e93b42a02016f9d009aef (patch)
treeca4312aad89b1a198eab033f972ee2882d8ce04b /src
parent06a3a69e6f38798b1768976520b8db40c9a210bf (diff)
downloadzig-4d4ab1e69a40fb11d19e93b42a02016f9d009aef.tar.gz
zig-4d4ab1e69a40fb11d19e93b42a02016f9d009aef.zip
stage1: Fix comparison of unions containing zero-sized types
The code tried to be too smart and skipped the equality (returning true) if the payload type was zero-sized. This optimization is completely wrong when the union payload is a metatype! Fixes #7047
Diffstat (limited to 'src')
-rw-r--r--src/stage1/analyze.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp
index 45cd240949..2fe4410027 100644
--- a/src/stage1/analyze.cpp
+++ b/src/stage1/analyze.cpp
@@ -7079,8 +7079,6 @@ bool const_values_equal(CodeGen *g, ZigValue *a, ZigValue *b) {
if (bigint_cmp(&union1->tag, &union2->tag) == CmpEQ) {
TypeUnionField *field = find_union_field_by_tag(a->type, &union1->tag);
assert(field != nullptr);
- if (!type_has_bits(g, field->type_entry))
- return true;
assert(find_union_field_by_tag(a->type, &union2->tag) != nullptr);
return const_values_equal(g, union1->payload, union2->payload);
}