diff options
Diffstat (limited to 'bootstrap/parse.c')
| -rw-r--r-- | bootstrap/parse.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c index 59d3b5f..02980cc 100644 --- a/bootstrap/parse.c +++ b/bootstrap/parse.c @@ -2327,7 +2327,8 @@ parsefn(struct decl *decl, struct parser *P) { putdecl(P, tok.span, &decl); } fn->body = xcalloc(1, sizeof *fn->body); - *fn->body = parseblock(P); + WITH_TMPCHANGE(int, P->varid, 0) + *fn->body = parseblock(P); popenv(P); } } @@ -2599,8 +2600,11 @@ parseagg(struct parser *P, const char *name, int kind, struct decl **retdecl) { } } + if (!flds.length && kind == TYeunion) + fatal(P, tok.span, "enum union must have at least 1 variant"); + struct type *ppty = (struct type *)pty; - ppty->size = ALIGNUP(size, align); + ppty->size = size ? ALIGNUP(size, align) : 1; ppty->align = align; vec_slice_cpy(&ppty->agg.flds, &flds); |