aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/basic.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-06-05 20:36:56 +0300
committerAndrew Kelley <andrew@ziglang.org>2022-06-06 13:11:50 -0700
commit84000aa820de2d00571f7e8fde5d3973e2fdc441 (patch)
treef6bba6a2098749101eed7ba7a1fa21f8e23dab50 /test/behavior/basic.zig
parent8fa88c88c28420d89392a9984748070d35f18321 (diff)
downloadzig-84000aa820de2d00571f7e8fde5d3973e2fdc441.tar.gz
zig-84000aa820de2d00571f7e8fde5d3973e2fdc441.zip
Sema: fix inline call of func using ret_ptr with comptime only type
Diffstat (limited to 'test/behavior/basic.zig')
-rw-r--r--test/behavior/basic.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index dc0e5aaf30..a69df862c1 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -1074,3 +1074,15 @@ test "switch inside @as gets correct type" {
else => 0,
});
}
+
+test "inline call of function with a switch inside the return statement" {
+ const S = struct {
+ inline fn foo(x: anytype) @TypeOf(x) {
+ return switch (x) {
+ 1 => 1,
+ else => unreachable,
+ };
+ }
+ };
+ try expect(S.foo(1) == 1);
+}