aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-05-31 04:42:18 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:57 -0700
commita0d4ef0acf50db06fdde8ff229d20d15afc7d402 (patch)
tree92b320040e5a979d569a5284e71c6fcdf7ee893f /src/codegen/c.zig
parent99531b0d52392668fe9f86b5109fff74cd37aff3 (diff)
downloadzig-a0d4ef0acf50db06fdde8ff229d20d15afc7d402.tar.gz
zig-a0d4ef0acf50db06fdde8ff229d20d15afc7d402.zip
InternPool: add representation for value of empty enums and unions
This is a bit odd, because this value doesn't actually exist: see #15909. This gets all the empty enum/union behavior tests passing. Also adds an assertion to `Sema.analyzeBodyInner` which would have helped figure out the issue here much more quickly.
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 56f6c669df..eea6e14896 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -946,6 +946,7 @@ pub const DeclGen = struct {
.extern_func,
.func,
.enum_literal,
+ .empty_enum_value,
=> unreachable, // non-runtime values
.int => |int| switch (int.storage) {
.u64, .i64, .big_int => try writer.print("{}", .{try dg.fmtIntLiteral(ty, val, location)}),