diff options
| author | 2025-12-15 11:16:38 +0100 | |
|---|---|---|
| committer | 2025-12-15 11:16:38 +0100 | |
| commit | 068aaef0ea684ecf5f891559aa8e1dae03b8428d (patch) | |
| tree | 07e9685132f22f45bd5d8fe7c66b00e9ed98ad5e /type.h | |
| parent | c244d3c1ba501796152c2278a040cf940b660ea6 (diff) | |
c: support forward-declared enums
This is a common non-standard GNU extension.
Diffstat (limited to 'type.h')
| -rw-r--r-- | type.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -136,7 +136,7 @@ union type cvtarith(union type a, union type b); static inline union type typechild(union type t) { - if (t.t == TYENUM) return mktype(t.backing); + if (t.t == TYENUM) return mktype(t.backing ? t.backing : typedata[t.dat].backing); if (t.flag & TFCHLDPRIM) return mktype(t.child); if (t.flag & TFCHLDISDAT) { union type chld = mktype(typedata[t.dat].t, .dat = t.dat); @@ -148,7 +148,7 @@ typechild(union type t) static inline enum typetag scalartypet(union type t) { - if (t.t == TYENUM) return t.backing; + if (t.t == TYENUM) return t.backing ? t.backing : typedata[t.dat].backing; if (isptrcvt(t)) return TYPTR; return t.t; } |