summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-03-11 13:49:54 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-03-11 13:49:54 -0400
commitaf78ae105bbf82136c82b8727115e7ea70577e57 (patch)
tree4a4db42a7383a16c40316fbe66ee0a89eb288353 /parse.c
parent8617b3bdd084cf45f4351f96e154f7ec76e0b266 (diff)
no semiconst or struct varargs
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index d5b21a4..1430d2e 100644
--- a/parse.c
+++ b/parse.c
@@ -649,6 +649,11 @@ static Status parse_type(Parser *p, Type *type, Location *where) {
err_print(param->where, "Struct parameters must be constant.");
goto struct_fail;
}
+ if ((param->flags & DECL_ANNOTATES_TYPE) && type_is_builtin(&param->type, BUILTIN_VARARGS)) {
+ /* TODO(eventually) */
+ err_print(param->where, "structs cannot have varargs parameters (yet).");
+ goto struct_fail;
+ }
if (param->flags & DECL_INFER) {
/* TODO(eventually) */
err_print(param->where, "Struct parameters cannot be inferred (yet).");
@@ -2286,6 +2291,10 @@ static Status parse_decl(Parser *p, Declaration *d, DeclEndKind ends_with, U16 f
d->type.was_expr = NULL;
d->type.builtin = BUILTIN_VARARGS;
is_varargs = true;
+ if (d->flags & DECL_SEMI_CONST) {
+ tokr_err(t, "Semi-constant varargs are not allowed. Sorry!");
+ goto ret_false;
+ }
++t->token;
} else {
Type type;