From 84000aa820de2d00571f7e8fde5d3973e2fdc441 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Sun, 5 Jun 2022 20:36:56 +0300 Subject: Sema: fix inline call of func using ret_ptr with comptime only type --- test/behavior/basic.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/behavior/basic.zig') 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); +} -- cgit v1.2.3