aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-12-22 13:41:33 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-12-22 13:41:33 -0700
commitfe3ad27d5f909fbe1e4d6f863dcf5f69b7dc6507 (patch)
treec77d1f34c754f0717ab76f54f1b987b1c5ae295a /test/run_tests.cpp
parent431170d981edf1eba790cefe0f27a6142634ea1d (diff)
downloadzig-fe3ad27d5f909fbe1e4d6f863dcf5f69b7dc6507.tar.gz
zig-fe3ad27d5f909fbe1e4d6f863dcf5f69b7dc6507.zip
analyze: error for infinite size struct
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 2566df9ada..53efe09ae2 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -828,6 +828,16 @@ fn f() {
}
)SOURCE", 2, ".tmp_source.zig:3:21: error: expected type 'i32', got 'void'",
".tmp_source.zig:4:15: error: incompatible types: 'i32' and 'void'");
+
+ add_compile_fail_case("direct struct loop", R"SOURCE(
+struct A { a : A, }
+ )SOURCE", 1, ".tmp_source.zig:2:1: error: struct has infinite size");
+
+ add_compile_fail_case("indirect struct loop", R"SOURCE(
+struct A { b : B, }
+struct B { c : C, }
+struct C { a : A, }
+ )SOURCE", 1, ".tmp_source.zig:2:1: error: struct has infinite size");
}
static void print_compiler_invocation(TestCase *test_case) {