[llvm] [ADT] [NFC] Resolve a potential overload ambiguity in the ADT unit tests (PR #85341)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 17:33:54 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Wolfgang Pieb (wolfy1961)
<details>
<summary>Changes</summary>
Some compilers (ex. VS2019 and VS2022) report an overload resolution error with the APInt constructor.
Resolve the ambiguity with a static_cast.
---
Full diff: https://github.com/llvm/llvm-project/pull/85341.diff
1 Files Affected:
- (modified) llvm/unittests/ADT/APIntTest.cpp (+1-1)
``````````diff
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 400313a6234677..c3805431e6b2b6 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -2918,7 +2918,7 @@ TEST(APIntTest, Average) {
APInt A100(32, 100);
APInt A101(32, 101);
APInt A200(32, 200, false);
- APInt ApUMax(32, UINT_MAX, false);
+ APInt ApUMax(32, static_cast<uint64_t>(UINT_MAX), false);
EXPECT_EQ(APInt(32, 150), APIntOps::avgFloorU(A100, A200));
EXPECT_EQ(APIntOps::RoundingUDiv(A100 + A200, A2, APInt::Rounding::DOWN),
``````````
</details>
https://github.com/llvm/llvm-project/pull/85341
More information about the llvm-commits
mailing list