[llvm] [ADT] [NFC] Resolve a potential overload ambiguity in the ADT unit tests (PR #85341)
Wolfgang Pieb via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 17:33:22 PDT 2024
https://github.com/wolfy1961 created https://github.com/llvm/llvm-project/pull/85341
Some compilers (ex. VS2019 and VS2022) report an overload resolution error with the APInt constructor.
Resolve the ambiguity with a static_cast.
>From 3ff605ee36e49be9ffac6d5485154e0adbc364cf Mon Sep 17 00:00:00 2001
From: wpieb <Wolfgang.Pieb at sony.com>
Date: Thu, 14 Mar 2024 17:00:54 -0700
Subject: [PATCH] [ADT] Resolve a potential overload ambiguity in the ADT unit
tests
---
llvm/unittests/ADT/APIntTest.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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),
More information about the llvm-commits
mailing list