aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/decl.c b/decl.c
index 6fb74fc..f9640fc 100644
--- a/decl.c
+++ b/decl.c
@@ -544,6 +544,12 @@ declarator(struct scope *s, struct type *base, char **name, bool allowabstract)
t = listelement(l, struct type, link);
t->base = base;
switch (t->kind) {
+ case TYPEFUNC:
+ if (base->kind == TYPEFUNC)
+ error(&tok.loc, "function declarator specifies function return type");
+ if (base->kind == TYPEARRAY)
+ error(&tok.loc, "function declarator specifies array return type");
+ break;
case TYPEARRAY:
t->align = base->align;
t->size = base->size * t->array.length; // XXX: overflow?