From 8754499cd20a79aeff1bc208941db830fb8e44a4 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Fri, 1 Mar 2019 23:48:08 -0800 Subject: Array element cannot have incomplete or function type --- decl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/decl.c b/decl.c index 7bd2cbb..505f900 100644 --- a/decl.c +++ b/decl.c @@ -555,6 +555,10 @@ declarator(struct scope *s, struct type *base, char **name, bool allowabstract) error(&tok.loc, "function declarator specifies array return type"); break; case TYPEARRAY: + if (base->incomplete) + error(&tok.loc, "array element has incomplete type"); + if (base->kind == TYPEFUNC) + error(&tok.loc, "array element has function type"); t->align = base->align; t->size = base->size * t->array.length; // XXX: overflow? break; -- cgit v1.2.3