| author | |
| committer | |
| log | adc6dec26b8ba9f79aabc4b69ae689acf4c6767d |
| tree | e2d75f52b177a937993f17f8a3a915a1f66b9515 |
| parent | 1d96a17af473d5ca79ecc7b64bbf2e899b5de3b4 |
Fixes #148543 files changed, 15 insertions(+), 1 deletions(-)
src/Sema.zig+1-1| ... | @@ -8782,7 +8782,7 @@ fn funcCommon( | ... | @@ -8782,7 +8782,7 @@ fn funcCommon( |
| 8782 | }; | 8782 | }; |
| 8783 | return sema.failWithOwnedErrorMsg(msg); | 8783 | return sema.failWithOwnedErrorMsg(msg); |
| 8784 | } | 8784 | } |
| 8785 | if (!Type.fnCallingConventionAllowsZigTypes(cc_resolved) and !try sema.validateExternType(return_type, .ret_ty)) { | 8785 | if (!ret_poison and !Type.fnCallingConventionAllowsZigTypes(cc_resolved) and !try sema.validateExternType(return_type, .ret_ty)) { |
| 8786 | const msg = msg: { | 8786 | const msg = msg: { |
| 8787 | const msg = try sema.errMsg(block, ret_ty_src, "return type '{}' not allowed in function with calling convention '{s}'", .{ | 8787 | const msg = try sema.errMsg(block, ret_ty_src, "return type '{}' not allowed in function with calling convention '{s}'", .{ |
| 8788 | return_type.fmt(sema.mod), @tagName(cc_resolved), | 8788 | return_type.fmt(sema.mod), @tagName(cc_resolved), |
test/behavior.zig+1| ... | @@ -141,6 +141,7 @@ test { | ... | @@ -141,6 +141,7 @@ test { |
| 141 | _ = @import("behavior/bugs/13664.zig"); | 141 | _ = @import("behavior/bugs/13664.zig"); |
| 142 | _ = @import("behavior/bugs/13714.zig"); | 142 | _ = @import("behavior/bugs/13714.zig"); |
| 143 | _ = @import("behavior/bugs/13785.zig"); | 143 | _ = @import("behavior/bugs/13785.zig"); |
| 144 | _ = @import("behavior/bugs/14854.zig"); | ||
| 144 | _ = @import("behavior/byteswap.zig"); | 145 | _ = @import("behavior/byteswap.zig"); |
| 145 | _ = @import("behavior/byval_arg_var.zig"); | 146 | _ = @import("behavior/byval_arg_var.zig"); |
| 146 | _ = @import("behavior/call.zig"); | 147 | _ = @import("behavior/call.zig"); |
test/behavior/bugs/14854.zig created+13| ... | @@ -0,0 +1,13 @@ | ||
| 1 | const testing = @import("std").testing; | ||
| 2 | |||
| 3 | test { | ||
| 4 | try testing.expect(getGeneric(u8, getU8) == 123); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn getU8() callconv(.C) u8 { | ||
| 8 | return 123; | ||
| 9 | } | ||
| 10 | |||
| 11 | fn getGeneric(comptime T: type, supplier: fn () callconv(.C) T) T { | ||
| 12 | return supplier(); | ||
| 13 | } | ||