Sema: resolve lazy values in analyzeMinMax

Closes #13797
This commit is contained in:
Veikka Tuominen 2022-12-07 14:48:10 +02:00
parent ddce76059b
commit dff32a2cd7
2 changed files with 10 additions and 0 deletions

View File

@ -21011,6 +21011,9 @@ fn analyzeMinMax(
if (rhs_val.isUndef()) return sema.addConstUndef(simd_op.result_ty);
try sema.resolveLazyValue(lhs_val);
try sema.resolveLazyValue(rhs_val);
const opFunc = switch (air_tag) {
.min => Value.numberMin,
.max => Value.numberMax,

View File

@ -95,3 +95,10 @@ test "@min for vectors" {
try S.doTheTest();
comptime try S.doTheTest();
}
test "@min/@max on lazy values" {
const A = extern struct { u8_4: [4]u8 };
const B = extern struct { u8_16: [16]u8 };
const size = @max(@sizeOf(A), @sizeOf(B));
try expect(size == @sizeOf(B));
}