aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-10-24 16:23:33 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-10-24 16:23:33 -0400
commit32c89531b1475ce8e3b8efdf7a07745da7bc854a (patch)
tree848ea8ac81eabbe6293eacdfc16210b1d6973a99 /src/ir.cpp
parent345042ecbc7fb645fd17b69df4e57ffefa5be5a5 (diff)
downloadzig-32c89531b1475ce8e3b8efdf7a07745da7bc854a.tar.gz
zig-32c89531b1475ce8e3b8efdf7a07745da7bc854a.zip
Add missing compile error when ptr used instead of array
in array literals. Fixes #3524
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 8aff5e4583..3b3814b3ad 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -17590,7 +17590,10 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct
false);
array_ptr_val->data.x_struct.fields[slice_ptr_index].data.x_ptr.mut = ConstPtrMutInfer;
} else {
- zig_unreachable();
+ ir_add_error(ira, elem_ptr_instruction->init_array_type,
+ buf_sprintf("expected array type or [_], found '%s'",
+ buf_ptr(&array_type->name)));
+ return ira->codegen->invalid_instruction;
}
}