aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-21 17:41:49 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-21 17:41:49 -0400
commit459d72f8736ebd8372b9050c17e5f3bc00092573 (patch)
tree989e276143fcc59055202f234c7d2209b69ab6d5 /test/compile_errors.zig
parent5f38d6e2e97829ed74f06a96b5d07a2c68516063 (diff)
downloadzig-459d72f8736ebd8372b9050c17e5f3bc00092573.tar.gz
zig-459d72f8736ebd8372b9050c17e5f3bc00092573.zip
fix compiler crash for invalid enum
closes #1079 closes #1147
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 17896f9ab9..2247f0af96 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,19 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "enum field value references enum",
+ \\pub const Foo = extern enum {
+ \\ A = Foo.B,
+ \\ C = D,
+ \\};
+ \\export fn entry() void {
+ \\ var s: Foo = Foo.E;
+ \\}
+ ,
+ ".tmp_source.zig:1:17: error: 'Foo' depends on itself",
+ );
+
+ cases.add(
"@floatToInt comptime safety",
\\comptime {
\\ _ = @floatToInt(i8, f32(-129.1));