aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/generics.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/generics.zig b/test/behavior/generics.zig
index 767c2f3ee3..867cf940b8 100644
--- a/test/behavior/generics.zig
+++ b/test/behavior/generics.zig
@@ -277,3 +277,16 @@ test "generic function instantiation turns into comptime call" {
};
try S.doTheTest();
}
+
+test "generic function with void and comptime parameter" {
+ const S = struct { x: i32 };
+ const namespace = struct {
+ fn foo(v: void, s: *S, comptime T: type) !void {
+ _ = @as(void, v);
+ try expect(s.x == 1234);
+ try expect(T == u8);
+ }
+ };
+ var s: S = .{ .x = 1234 };
+ try namespace.foo({}, &s, u8);
+}