Skip to content

Commit 5bd8f48

Browse files
committed
[FileCheck] Fix MSVC 'argument': truncation from 'int' to 'bool' warning.
Ensure expectOperationValueResult performs the is_integral_v as constexpr to prevent MSVC getting confused between the mixture of integer / string constructors in the if-else. Warning introduced in D150880
1 parent 943fda5 commit 5bd8f48

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/unittests/FileCheck/FileCheckTest.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,11 @@ static void expectOperationValueResult(binop_eval_t Operation, T1 LeftValue,
395395
T2 RightValue, TR ResultValue) {
396396
APInt LeftVal(LiteralsBitWidth, LeftValue, std::is_signed_v<T1>);
397397
APInt RightVal(LiteralsBitWidth, RightValue, std::is_signed_v<T2>);
398-
APInt ResultVal =
399-
std::is_integral_v<TR>
400-
? APInt(LiteralsBitWidth, ResultValue, std::is_signed_v<TR>)
401-
: APInt(LiteralsBitWidth, ResultValue, /*Radix=*/10);
398+
APInt ResultVal;
399+
if constexpr (std::is_integral_v<TR>)
400+
ResultVal = APInt(LiteralsBitWidth, ResultValue, std::is_signed_v<TR>);
401+
else
402+
ResultVal = APInt(LiteralsBitWidth, ResultValue, /*Radix=*/10);
402403
expectOperationValueResult(Operation, LeftVal, RightVal, ResultVal);
403404
}
404405

0 commit comments

Comments
 (0)