Skip to content

Commit

Permalink
Parser: check for invalid type as array size
Browse files Browse the repository at this point in the history
Closes Vexu#585

Co-authored-by: Veikka Tuominen <[email protected]>
  • Loading branch information
ehaas and Vexu committed Dec 15, 2023
1 parent 7dd1575 commit bbb912e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/aro/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2980,6 +2980,7 @@ fn directDeclarator(p: *Parser, base_type: Type, d: *Declarator, kind: Declarato
if (max_bits > 61) max_bits = 61;
const max_bytes = (@as(u64, 1) << @truncate(max_bits)) - 1;

if (size.ty.is(.invalid)) return Type.invalid;
if (!size.ty.isInt()) {
try p.errStr(.array_size_non_int, size_tok, try p.typeStr(size.ty));
return error.ParsingFailed;
Expand Down

0 comments on commit bbb912e

Please sign in to comment.