aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-22 16:40:15 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-22 16:40:15 -0700
commit7bd9c8238626998f8016086762483114e5c58f70 (patch)
tree544bf96dece1861e7d99062a239e5a01927aedb3 /test/run_tests.cpp
parent72fa03badad2e5837f639359a63a75abaa99a479 (diff)
downloadzig-7bd9c8238626998f8016086762483114e5c58f70.tar.gz
zig-7bd9c8238626998f8016086762483114e5c58f70.zip
add compile error for non constant expr global
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index a48120ef63..9150d96079 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1567,6 +1567,13 @@ fn f() => {
};
}
)SOURCE", 1, ".tmp_source.zig:6:9: error: multiple else prongs in switch expression");
+
+ add_compile_fail_case("global variable initializer must be constant expression", R"SOURCE(
+extern {
+ fn foo() i32;
+}
+const x = foo();
+ )SOURCE", 1, ".tmp_source.zig:5:11: error: global variable initializer requires constant expression");
}
static void print_compiler_invocation(TestCase *test_case) {