diff options
Diffstat (limited to 'bootstrap/parse.c')
| -rw-r--r-- | bootstrap/parse.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c index 297f2a9..daf632d 100644 --- a/bootstrap/parse.c +++ b/bootstrap/parse.c @@ -2371,6 +2371,8 @@ parsefn(struct decl *decl, struct parser *P) { struct tok tok; struct fn *fn = &decl->fn; const char *name = fn->name; + static int id; + memset(fn, 0, sizeof *fn); fn->name = name; @@ -2401,10 +2403,9 @@ parsefn(struct decl *decl, struct parser *P) { fatal(P, tok.span, "return type is incomplete (%t)", fn->retty); } + fn->id = id++; if (!lexmatch(P, &tok, ';')) { struct env *env = xcalloc(1, sizeof *env); - static int id; - fn->id = id++; lexexpect(P, '{'); env->parent = P->curenv; @@ -2646,6 +2647,7 @@ parseagg(struct parser *P, const char *name, int kind, struct decl **retdecl) { struct decl *decl = (struct decl *)envfind(&env_noparent, P->envage, name); if (decl && decl->t == Dtype && decl->ty->t == kind) { pty = decl->ty; + *(bool *)&pty->agg.fwd = 0; } else { pty = interntype((struct type) { kind, .agg.name = name, .agg.id = id++ |