aboutsummaryrefslogtreecommitdiff
path: root/src/parse.cff
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-19 13:01:16 +0200
committerlemon <lsof@mailbox.org>2022-08-19 13:01:16 +0200
commit9e408967cbdfa1d04e4bd4bc963399e7be78c0a7 (patch)
tree69f1b0ba4de0d59d4c8a0695be6d50b4b4a8a6e7 /src/parse.cff
parent9b456aaff9d423e000c1afe537591497962029df (diff)
fix hashing and typeeq for enums
Diffstat (limited to 'src/parse.cff')
-rw-r--r--src/parse.cff4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parse.cff b/src/parse.cff
index 5caa998..cbeccb1 100644
--- a/src/parse.cff
+++ b/src/parse.cff
@@ -737,7 +737,9 @@ fn parseagg(P *Parser, loc Loc, kind AggKind, name *const u8, retdecl **Decl) *c
if kind == :EUnion {
// add enum tag field on top and offset every other field down
static id int = 0;
- let enumty Type = { .u: :Enum { #null, name, .id: --id }};
+ let enumname [200]u8 = {};
+ snprintf(enumname, sizeof(enumname) - 1, "%s#tag",name);
+ let enumty Type = { .u: :Enum { #null, internstr(enumname), .id: --id }};
let n = flds.len;
enumty.u.Enum.vals = (as(*EnumVal)malloc(n * sizeof EnumVal))[0::n];
if n < 256 {