diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-02-02 19:09:53 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-02-02 19:09:53 -0700 |
| commit | 8058b5e0a92e4eac05ba19aabed1fc041353c69b (patch) | |
| tree | 42b52618d9da5503dd4e7eb1702cf4d4be3a5a71 /test/run_tests.cpp | |
| parent | 79adf55699a549841eba3eb07f1dbb19c4da9ed1 (diff) | |
| download | zig-8058b5e0a92e4eac05ba19aabed1fc041353c69b.tar.gz zig-8058b5e0a92e4eac05ba19aabed1fc041353c69b.zip | |
fix crash when incomplete struct used as argument
closes #107
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 39bbf504b8..946f55f9fd 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1513,6 +1513,42 @@ pub fn main(args: [][]u8) -> %void { %%stdout.printf("OK\n"); } )SOURCE", "OK\n"); + + + add_simple_case("incomplete struct parameter top level decl", R"SOURCE( +import "std.zig"; +struct A { + b: B, +} + +struct B { + c: C, +} + +struct C { + x: i32, + + fn d(c: C) { + %%stdout.printf("OK\n"); + } +} + +fn foo(a: A) { + a.b.c.d(); +} + +pub fn main(args: [][]u8) -> %void { + const a = A { + .b = B { + .c = C { + .x = 13, + }, + }, + }; + foo(a); +} + + )SOURCE", "OK\n"); } |
