From b147ff5b60ebb32ec5a3c1f6da82601201d5ad9a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 10 Jan 2016 18:56:50 -0700 Subject: fix codegen for void struct fields --- test/run_tests.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/run_tests.cpp') diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 582b2671f2..6858cf1bbc 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -326,6 +326,31 @@ fn void_fun(a : i32, b : void, c : i32) { } )SOURCE", "OK\n"); + add_simple_case("void struct fields", R"SOURCE( +use "std.zig"; +struct Foo { + a : void, + b : i32, + c : void, +} +pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 { + const foo = Foo { + .a = void, + .b = 1, + .c = void, + }; + if (foo.b != 1) { + print_str("BAD\n"); + } + if (#sizeof(Foo) != 4) { + print_str("BAD\n"); + } + print_str("OK\n"); + return 0; +} + + )SOURCE", "OK\n"); + add_simple_case("mutable local variables", R"SOURCE( use "std.zig"; -- cgit v1.2.3