authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-12-20 23:28:13+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-12-21 12:40:51+02:00
log286077fec8f381c7b4d4d5bf351d963564a1dd69
tree09110b434343c02573e454bb7204bdfb7d858521
parent4918605176c2e48c178847ea281b790334207733

stage1: add missing error check on inferred struct field ptr


2 files changed, 8 insertions(+), 0 deletions(-)

src/stage1/ir.cpp+3
......@@ -19980,6 +19980,9 @@ static IrInstGen *ir_resolve_result(IrAnalyze *ira, IrInst *suspend_source_instr
1998019980
1998119981 result_loc = ir_analyze_struct_field_ptr(ira, suspend_source_instr, field, casted_ptr,
1998219982 isf->inferred_struct_type, true);
19983 if (type_is_invalid(result_loc->value->type)) {
19984 return result_loc;
19985 }
1998319986 result_loc_pass1->resolved_loc = result_loc;
1998419987 }
1998519988
test/compile_errors.zig+5
......@@ -2376,8 +2376,13 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
23762376 \\export fn entry() void {
23772377 \\ const x = [_]u8;
23782378 \\}
2379 \\export fn entry2() void {
2380 \\ const S = struct { a: *const [_]u8 };
2381 \\ var a = .{ S{} };
2382 \\}
23792383 , &[_][]const u8{
23802384 "tmp.zig:2:15: error: inferred array size invalid here",
2385 "tmp.zig:5:34: error: inferred array size invalid here",
23812386 });
23822387
23832388 cases.add("initializing array with struct syntax",