summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 8bd56fb..17c9819 100644
--- a/parse.c
+++ b/parse.c
@@ -609,8 +609,19 @@ static bool parse_type(Parser *p, Type *type) {
++t->token;
if (token_is_kw(t->token, KW_LPAREN)) {
++t->token;
+ if (token_is_kw(t->token, KW_RPAREN)) {
+ tokr_err(t, "Empty struct parameter lists are not allowed.");
+ goto struct_fail;
+ }
if (!parse_decl_list(p, &struc->params, DECL_END_RPAREN_COMMA))
goto struct_fail;
+
+ arr_foreach(struc->params, Declaration, param) {
+ if (!(param->flags & DECL_IS_CONST)) {
+ err_print(param->where, "Struct parameters must be constant.");
+ goto struct_fail;
+ }
+ }
}
if (!token_is_kw(t->token, KW_LBRACE)) {
tokr_err(t, "Expected { to follow struct.");