[PATCH] D129567: [Fixed Point] Fix C++20 compilation error

Antonio Frighetto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 08:50:59 PDT 2022


antoniofrighetto created this revision.
antoniofrighetto added a reviewer: aaron.ballman.
Herald added a project: All.
antoniofrighetto requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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` class.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129567

Files:
  llvm/unittests/ADT/APFixedPointTest.cpp


Index: llvm/unittests/ADT/APFixedPointTest.cpp
===================================================================
--- llvm/unittests/ADT/APFixedPointTest.cpp
+++ llvm/unittests/ADT/APFixedPointTest.cpp
@@ -220,11 +220,12 @@
 }
 
 void CheckIntPartMin(const FixedPointSemantics &Sema, int64_t Expected) {
-  ASSERT_EQ(APFixedPoint::getMin(Sema).getIntPart(), Expected);
+  ASSERT_EQ(APFixedPoint::getMin(Sema).getIntPart(), APSInt::get(Expected));
 }
 
 void CheckIntPartMax(const FixedPointSemantics &Sema, uint64_t Expected) {
-  ASSERT_EQ(APFixedPoint::getMax(Sema).getIntPart(), Expected);
+  ASSERT_EQ(APFixedPoint::getMax(Sema).getIntPart(),
+            APSInt::getUnsigned(Expected));
 }
 
 TEST(FixedPoint, getIntPart) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129567.443962.patch
Type: text/x-patch
Size: 730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220712/7281804a/attachment.bin>


More information about the llvm-commits mailing list