Sema: don't emit instruction when casting @min/@max result to OPV type
Resolves: #21408
This commit is contained in:
@@ -336,3 +336,17 @@ test "@min/@max of signed and unsigned runtime integers" {
|
||||
try expectEqual(x, @min(x, y));
|
||||
try expectEqual(y, @max(x, y));
|
||||
}
|
||||
|
||||
test "@min resulting in u0" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn min(a: u0, b: u8) u8 {
|
||||
return @min(a, b);
|
||||
}
|
||||
};
|
||||
const x = S.min(0, 1);
|
||||
try expect(x == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user