aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2019-02-19 21:18:57 +0100
committerAndrew Kelley <andrew@ziglang.org>2019-02-19 15:18:57 -0500
commit400006bbe790f2173fd6e40d80608691a95b437e (patch)
tree42d980d1b064c0efd1f8aa602e03994f811129e3 /test/compile_errors.zig
parentdb74832e40f98960e5dc3e46c8196c59033ee0f9 (diff)
downloadzig-400006bbe790f2173fd6e40d80608691a95b437e.tar.gz
zig-400006bbe790f2173fd6e40d80608691a95b437e.zip
Prevent crash in tagged enums rendering (#1986)
* Prevent crash in tagged enums rendering * Add a test case
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index e9fe6f589c..b935b4825a 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -5599,4 +5599,21 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
,
".tmp_source.zig:2:26: error: vector element type must be integer, float, or pointer; '@Vector(4, u8)' is invalid",
);
+
+ cases.add(
+ "compileLog of tagged enum doesn't crash the compiler",
+ \\const Bar = union(enum(u32)) {
+ \\ X: i32 = 1
+ \\};
+ \\
+ \\fn testCompileLog(x: Bar) void {
+ \\ @compileLog(x);
+ \\}
+ \\
+ \\pub fn main () void {
+ \\ comptime testCompileLog(Bar{.X = 123});
+ \\}
+ ,
+ ".tmp_source.zig:6:5: error: found compile log statement"
+ );
}