From 25bf34e2c15b93e1cedab14cc83dddbb08ffcf3b Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 11 Aug 2022 06:51:48 +0200 Subject: more fix --- bootstrap/parse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bootstrap/parse.c') 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++ -- cgit v1.2.3