fix crash when compile error in analyzing @panic call

This commit is contained in:
Andrew Kelley
2018-03-27 15:07:45 -04:00
parent 0b7b3190fd
commit 6cb99fdac3
2 changed files with 12 additions and 3 deletions

View File

@@ -1,6 +1,15 @@
const tests = @import("tests.zig");
pub fn addCases(cases: &tests.CompileErrorContext) void {
cases.add("wrong type passed to @panic",
\\export fn entry() void {
\\ var e = error.Foo;
\\ @panic(e);
\\}
,
".tmp_source.zig:3:12: error: expected type '[]const u8', found 'error{Foo}'");
cases.add("@tagName used on union with no associated enum tag",
\\const FloatInt = extern union {
\\ Float: f32,