diff options
author | Michael Forney <mforney@mforney.org> | 2019-05-19 01:06:03 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-05-19 01:06:03 -0700 |
commit | bb3a22a3eb6b0b2be52620577c1ef5465d3bcd76 (patch) | |
tree | 50ea116d660fde5fadeb0dea6e71e73231802b0a /decl.c | |
parent | f41c37d7be16f7845795bae95e1356ca1f7a2fd6 (diff) |
decl: Allow zero length arrays
gcc allows this, and glibc uses it in some headers instead of flexible
array members.
Diffstat (limited to 'decl.c')
-rw-r--r-- | decl.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -552,8 +552,8 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs if (e->kind != EXPRCONST || !(e->type->prop & PROPINT)) error(&tok.loc, "VLAs are not yet supported"); i = e->constant.i; - if (i == 0 || e->type->basic.issigned && i > INT64_MAX) - error(&tok.loc, "array length must be positive"); + if (e->type->basic.issigned && i > INT64_MAX) + error(&tok.loc, "array length must be non-negative"); delexpr(e); expect(TRBRACK, "after array length"); } |