From 3bdc9dc8a2e53cb745e0555dc30f0e2b2df4d444 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Tue, 19 Nov 2019 19:49:50 -0800 Subject: decl: Parse array size as an assignment-expression Even though we don't support VLAs yet, we should still be parsing the VLA syntax, then failing after if it was not a constant expression. --- decl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decl.c b/decl.c index 8eae666..9013a09 100644 --- a/decl.c +++ b/decl.c @@ -565,7 +565,7 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs i = 0; next(); } else { - e = constexpr(s); + e = eval(assignexpr(s), EVALARITH); if (e->kind != EXPRCONST || !(e->type->prop & PROPINT)) error(&tok.loc, "VLAs are not yet supported"); i = e->constant.i; -- cgit v1.2.3