Skip to content

Commit 04027a4

Browse files
committed
Fix asuint operator when applied to int values.
Bother to mark the APSInt result as unsigned, to avoid tripping IntExprEvaluator::Success's assertion that SI.isSigned() matches E's type. Fixes microsoft#7395.
1 parent c75bb05 commit 04027a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/clang/lib/AST/ExprConstant.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3783,7 +3783,9 @@ static bool HandleIntrinsicCall(SourceLocation CallLoc, unsigned opcode,
37833783
case hlsl::IntrinsicOp::IOP_asuint:
37843784
assert(Args.size() == 1 && "else call should be invalid");
37853785
if (ArgValues[0].isInt()) {
3786-
Result = ArgValues[0];
3786+
APSInt value = ArgValues[0].getInt();
3787+
value.setIsUnsigned(true);
3788+
Result = APValue(value);
37873789
}
37883790
else if (ArgValues[0].isFloat()) {
37893791
const bool isUnsignedTrue = true;

0 commit comments

Comments
 (0)