diff options
author | Michael Forney <mforney@mforney.org> | 2019-03-01 23:48:08 -0800 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-03-01 23:48:28 -0800 |
commit | 8754499cd20a79aeff1bc208941db830fb8e44a4 (patch) | |
tree | ba5793b29bc9cb798564e76bb8ba05f3adf9cd9b /decl.c | |
parent | 4d591275802ae08377d90c5881a93803350e42d6 (diff) |
Array element cannot have incomplete or function type
Diffstat (limited to 'decl.c')
-rw-r--r-- | decl.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; |