diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-04-18 18:18:41 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-04-18 18:18:41 -0700 |
| commit | ff1ab3fe9ce82a79f1e08236b8a7be42de1ff792 (patch) | |
| tree | 8715cf4371f04f52030c85c6e2ae4e4ae3b1e3b8 /test/run_tests.cpp | |
| parent | f4c7e1bf4971503e2d33af80537aef27ed2e4fe1 (diff) | |
| download | zig-ff1ab3fe9ce82a79f1e08236b8a7be42de1ff792.tar.gz zig-ff1ab3fe9ce82a79f1e08236b8a7be42de1ff792.zip | |
fix crash in non-const expression in struct literal outside fn
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index fdc03b0ae0..3d3d029387 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1191,6 +1191,15 @@ fn fibbonaci(x: i32) -> i32 { add_compile_fail_case("@embed_file with bogus file", R"SOURCE( const resource = @embed_file("bogus.txt"); )SOURCE", 1, ".tmp_source.zig:2:18: error: unable to find './bogus.txt'"); + + + add_compile_fail_case("non-const expression in struct literal outside function", R"SOURCE( +struct Foo { + x: i32, +} +const a = Foo {.x = get_it()}; +extern fn get_it() -> i32; + )SOURCE", 1, ".tmp_source.zig:5:27: error: unable to evaluate constant expression"); } ////////////////////////////////////////////////////////////////////////////// |
