[llvm] [ADT][Test] Fix build errors on windows. (PR #85356)

Haonan Yang via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 20:21:20 PDT 2024


https://github.com/haonanya created https://github.com/llvm/llvm-project/pull/85356

Fix build errors on APIntTest.cpp: error: call to constructor of 'APInt' is ambiguous
  APInt ApUMax(32, UINT_MAX, false);
  candidate constructor:
    APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
    APInt(unsigned numBits, uint64_t val, bool isSigned = false);

>From 1361e4efcc4b9a5db4bbea91087bcd1977d9962e Mon Sep 17 00:00:00 2001
From: Haonan Yang <haonan.yang at intel.com>
Date: Thu, 14 Mar 2024 20:15:05 -0700
Subject: [PATCH] [ADT][Test] Fix build errors on windows.

Fix build errors on APIntTest.cpp: error: call to constructor of 'APInt' is ambiguous
  APInt ApUMax(32, UINT_MAX, false);
  candidate constructor:
    APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
    APInt(unsigned numBits, uint64_t val, bool isSigned = false);
---
 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..5d77ef798b3b65 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, UINT_MAX);
 
   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