aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-07-29 10:30:10 +0300
committerVeikka Tuominen <git@vexu.eu>2022-07-30 00:17:49 +0300
commitf43ea43ac920d3fbd629175e4e7fbe4309c6eab5 (patch)
treed0edfe385cedffe26a15c325421c5029a1081977 /test
parent4fc2acdaa4f2b649b17ddf958d2608abc4787a4e (diff)
downloadzig-f43ea43ac920d3fbd629175e4e7fbe4309c6eab5.tar.gz
zig-f43ea43ac920d3fbd629175e4e7fbe4309c6eab5.zip
stage2: fix hashing of struct values
Closes #12279
Diffstat (limited to 'test')
-rw-r--r--test/behavior/tuple.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig
index 2442ae3629..4c43ef6be6 100644
--- a/test/behavior/tuple.zig
+++ b/test/behavior/tuple.zig
@@ -255,3 +255,23 @@ test "initializing anon struct with mixed comptime-runtime fields" {
var a: T = .{ .foo = -1234, .bar = x + 1 };
_ = a;
}
+
+test "tuple in tuple passed to generic function" {
+ if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
+ const S = struct {
+ fn pair(x: f32, y: f32) std.meta.Tuple(&.{ f32, f32 }) {
+ return .{ x, y };
+ }
+
+ fn foo(x: anytype) !void {
+ try expect(x[0][0] == 1.5);
+ try expect(x[0][1] == 2.5);
+ }
+ };
+ const x = comptime S.pair(1.5, 2.5);
+ try S.foo(.{x});
+}