From 5e9fe84d249d662abe1b3294471de317fdfe3afe Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Sun, 28 May 2023 03:03:31 +0200 Subject: [PATCH] test cases: array inside of anonymous struct Closes #7525 --- test/cases/array_in_anon_struct.zig | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/cases/array_in_anon_struct.zig diff --git a/test/cases/array_in_anon_struct.zig b/test/cases/array_in_anon_struct.zig new file mode 100644 index 0000000000..43e815d621 --- /dev/null +++ b/test/cases/array_in_anon_struct.zig @@ -0,0 +1,21 @@ +const std = @import("std"); + +noinline fn outer() u32 { + var a: u32 = 42; + return inner(.{ + .unused = a, + .value = [1]u32{0}, + }); +} + +noinline fn inner(args: anytype) u32 { + return args.value[0]; +} + +pub fn main() !void { + try std.testing.expect(outer() == 0); +} + +// run +// backend=llvm +// target=native