| author | |
| committer | |
| log | 648d34d8eacaf2e35e336abd5b0c50c2ab9bfc94 |
| tree | 3d211f9f81d98e1c6012f59325ec983f0a33d1ef |
| parent | b937a045607deae158ccb6a00f5defaf36510e61 |
Closes #133072 files changed, 12 insertions(+), 0 deletions(-)
src/Sema.zig+2| ... | ... | @@ -6738,6 +6738,8 @@ fn analyzeGenericCallArg( |
| 6738 | 6738 | try sema.queueFullTypeResolution(param_ty); |
| 6739 | 6739 | runtime_args[runtime_i.*] = casted_arg; |
| 6740 | 6740 | runtime_i.* += 1; |
| 6741 | } else if (try sema.typeHasOnePossibleValue(block, arg_src, comptime_arg.ty)) |_| { | |
| 6742 | _ = try sema.coerce(block, comptime_arg.ty, uncasted_arg, arg_src); | |
| 6741 | 6743 | } |
| 6742 | 6744 | } |
| 6743 | 6745 |
test/cases/compile_errors/zero-bit_generic_args_are_coerced_to_param_type.zig created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | fn bar(a: anytype, _: @TypeOf(a)) void {} | |
| 2 | pub export fn entry() void { | |
| 3 | bar(@as(u0, 0), "fooo"); | |
| 4 | } | |
| 5 | ||
| 6 | // error | |
| 7 | // backend=stage2 | |
| 8 | // target=native | |
| 9 | // | |
| 10 | // :3:21: error: expected type 'u0', found '*const [4:0]u8' |