diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-06-05 20:36:56 +0300 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-06-06 13:11:50 -0700 |
| commit | 84000aa820de2d00571f7e8fde5d3973e2fdc441 (patch) | |
| tree | f6bba6a2098749101eed7ba7a1fa21f8e23dab50 /test/behavior | |
| parent | 8fa88c88c28420d89392a9984748070d35f18321 (diff) | |
| download | zig-84000aa820de2d00571f7e8fde5d3973e2fdc441.tar.gz zig-84000aa820de2d00571f7e8fde5d3973e2fdc441.zip | |
Sema: fix inline call of func using ret_ptr with comptime only type
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/basic.zig | 12 |
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); +} |
