aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap')
-rw-r--r--bootstrap/cgen.c4
-rw-r--r--bootstrap/parse.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/bootstrap/cgen.c b/bootstrap/cgen.c
index 5a1180d..5c64a30 100644
--- a/bootstrap/cgen.c
+++ b/bootstrap/cgen.c
@@ -306,6 +306,7 @@ genexpr(struct expr *ex) {
}
}
+static void gendecl(struct decl *decl, bool toplevel);
static void genfn(bool externp, const char *cname, struct fn *fn);
static void genstatic(bool externp, const char *cname, struct var *var);
@@ -350,6 +351,7 @@ genstmt(struct stmt *stmt) {
genstatic(1, decl.name, &decl.var);
break;
case Ddef: case Dtype: case Dmacro: case Dtepl: case Dlabel:
+ gendecl(&stmt->decl, 0);
break;
}
break;
@@ -579,6 +581,8 @@ liftdecl(struct decl *decl) {
liftnestedex(decl->var.ini);
break;
case Dtype:
+ lifttype(decl->ty);
+ break;
case Dtepl:
for (struct teplcache *cache = decl->tepl.cache; cache; cache = cache->next) {
for (int i = 0; i < cache->args.n; ++i) {
diff --git a/bootstrap/parse.c b/bootstrap/parse.c
index 75a3279..4a1721d 100644
--- a/bootstrap/parse.c
+++ b/bootstrap/parse.c
@@ -1195,12 +1195,13 @@ pexprimary(struct parser *P) {
P->used_targty = 1;
if (!P->targty)
fatal(P, tok.span, "cannot infer type for compound initializer");
- if (lexmatch(P, &tok, '}'))
+ if (lexmatch(P, NULL, '}'))
ex.t = Ezeroini, ex.ty = P->targty;
else if (P->targty->t == TYstruct || P->targty->t == TYunion)
ex = parsestructini(P, P->targty);
else if (P->targty->t == TYarr)
ex = parsearrini(P, P->targty);
+ ex.span = tok.span;
} else if (lexmatch(P, &tok, TKkw_sizeof)) {
ex.t = Eintlit;
ex.ty = ty_isize;
@@ -1560,6 +1561,7 @@ pexprefix(struct parser *P) {
if (typeof2(to, from)) ;
else if (to->t == TYint && from->t == TYptr && to->size == from->size) ;
else if (from->t == TYint && to->t == TYptr && to->size == from->size) ;
+ else if (from->t == TYptr && to->t == TYptr) ;
else if (from->t == TYbool && to->t == TYint) ;
else if (from->t == TYint && to->t == TYbool) ;
else if (from->t == TYenum && to->t == TYint) ;