commit 1811928ec40590bcbeaf897666399fc846106886
parent c84e09c24fcd1c9c93671254fb919cfb0c5e538b
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 23 Dec 2020 12:08:18 -0500
parse_type: improve error message
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/parse.c b/src/parse.c
@@ -435,11 +435,14 @@ parse_type(struct parser *par, struct ast_type *type)
type->storage = TYPE_STORAGE_FUNCTION;
parse_prototype(par, &type->func);
break;
- default:
+ case T_NAME:
unlex(par->lex, &tok);
type->storage = TYPE_STORAGE_ALIAS;
parse_identifier(par, &type->alias);
break;
+ default:
+ synassert_msg(false, "expected type", &tok);
+ break;
}
trleave(TR_PARSE, "%s%s", type->flags & TYPE_CONST ? "const " : "",
type_storage_unparse(type->storage));