aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/init.c b/init.c
index 20e2f51..3e11c71 100644
--- a/init.c
+++ b/init.c
@@ -216,11 +216,14 @@ parseinit(struct scope *s, struct type *t)
struct expression *expr;
struct type *base;
+ t = typeunqual(t, NULL);
p.cur = NULL;
p.sub = p.obj;
p.sub->offset = 0;
- p.sub->type = typeunqual(t, NULL);
+ p.sub->type = t;
p.sub->iscur = false;
+ if (t->incomplete && !(t->kind == TYPEARRAY && t->array.length == 0))
+ error(&tok.loc, "initializer specified for incomplete type");
for (;;) {
if (p.cur) {
if (tok.kind == TLBRACK || tok.kind == TPERIOD)