aboutsummaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'init.c')
-rw-r--r--init.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/init.c b/init.c
index 1a7f5cd..c8f4128 100644
--- a/init.c
+++ b/init.c
@@ -206,8 +206,12 @@ parseinit(struct scope *s, struct type *t)
p.sub->iscur = false;
p.init = NULL;
p.last = &p.init;
- if (t->incomplete && t->kind != TYPEARRAY)
- error(&tok.loc, "initializer specified for incomplete type");
+ if (t->incomplete) {
+ if (t->kind != TYPEARRAY)
+ error(&tok.loc, "initializer specified for incomplete type");
+ } else if (t->kind == TYPEARRAY && t->size == 0) {
+ error(&tok.loc, "initializer specified for variable length array type");
+ }
for (;;) {
if (p.cur) {
if (tok.kind == TLBRACK || tok.kind == TPERIOD)