analyze: error for infinite size struct

This commit is contained in:
Andrew Kelley
2015-12-22 13:41:33 -07:00
parent 431170d981
commit fe3ad27d5f
3 changed files with 25 additions and 1 deletions

View File

@@ -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) {