aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tccgen.c b/tccgen.c
index cfa7d8f..e488c65 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -3166,13 +3166,13 @@ static void post_type(CType *type, AttributeDef *ad)
n = -1;
t1 = 0;
if (tok != ']') {
- gexpr();
+ if (!local_stack || nocode_wanted)
+ vpushi(expr_const());
+ else gexpr();
if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
n = vtop->c.i;
if (n < 0)
error("invalid array size");
- } else if (!local_stack) {
- error("expected constant expression (variably modified array at file scope)");
} else {
if (!is_integer_btype(vtop->type.t & VT_BTYPE))
error("size of variable length array should be an integer");