[llvm] b652815 - [Fixed Point] Fix C++20 compilation error

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 05:39:12 PDT 2022


Author: Antonio Frighetto
Date: 2022-07-13T08:36:04-04:00
New Revision: b652815236325f60b2874a1134c98ba10206a569

URL: https://github.com/llvm/llvm-project/commit/b652815236325f60b2874a1134c98ba10206a569
DIFF: https://github.com/llvm/llvm-project/commit/b652815236325f60b2874a1134c98ba10206a569.diff

LOG: [Fixed Point] Fix C++20 compilation error

Due to how operator== changed after operator<=> landing in C++20
(error: use of overloaded operator '==' is ambiguous (with operand
types 'const llvm::APSInt' and 'const unsigned long')),
CheckIntPartMin/CheckIntPartMax interfaces are now leveraging
APSInt::compareValues.

Differential Revision: https://reviews.llvm.org/D129567

Added: 
    

Modified: 
    llvm/unittests/ADT/APFixedPointTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/ADT/APFixedPointTest.cpp b/llvm/unittests/ADT/APFixedPointTest.cpp
index 53fa1cd8b503b..f54df99446d8f 100644
--- a/llvm/unittests/ADT/APFixedPointTest.cpp
+++ b/llvm/unittests/ADT/APFixedPointTest.cpp
@@ -220,11 +220,13 @@ void CheckIntPart(const FixedPointSemantics &Sema, int64_t IntPart) {
 }
 
 void CheckIntPartMin(const FixedPointSemantics &Sema, int64_t Expected) {
-  ASSERT_EQ(APFixedPoint::getMin(Sema).getIntPart(), Expected);
+  EXPECT_TRUE(APSInt::compareValues(APFixedPoint::getMin(Sema).getIntPart(),
+                                    APSInt::get(Expected)) == 0);
 }
 
 void CheckIntPartMax(const FixedPointSemantics &Sema, uint64_t Expected) {
-  ASSERT_EQ(APFixedPoint::getMax(Sema).getIntPart(), Expected);
+  EXPECT_TRUE(APSInt::compareValues(APFixedPoint::getMax(Sema).getIntPart(),
+                                    APSInt::getUnsigned(Expected)) == 0);
 }
 
 TEST(FixedPoint, getIntPart) {


        


More information about the llvm-commits mailing list