From bbb912e43df4766177885f43af0d0931ceffc0b4 Mon Sep 17 00:00:00 2001 From: Evan Haas Date: Mon, 27 Nov 2023 20:27:05 -0800 Subject: [PATCH] Parser: check for invalid type as array size Closes #585 Co-authored-by: Veikka Tuominen --- src/aro/Parser.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/aro/Parser.zig b/src/aro/Parser.zig index a4e5b9e8..6f030ac0 100644 --- a/src/aro/Parser.zig +++ b/src/aro/Parser.zig @@ -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;