From 127d76c37016f91fcaa5e4618cd1a5d6fa40b087 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 10 Jun 2020 17:57:54 +0200 Subject: [PATCH] Fix ambiguous comparisons error with C++20 ``` /home/cgal_tester/build/src/cmake/platforms/ArchLinux-clang-CXX20-Release/test/Kernel_d/afftrafo-test.cpp:136:31: error: use of overloaded operator '==' is ambiguous (with operand types 'VectorHd, CGAL::Linear_algebraHd<__gmp_expr, std::allocator<__gmp_expr > > >::RT, CGAL::VectorHd<__gmp_expr, CGAL::Linear_algebraHd<__gmp_expr, std::allocator<__gmp_expr > > >::LA>' (aka 'VectorHd<__gmp_expr, CGAL::Linear_algebraHd<__gmp_expr, std::allocator<__gmp_expr > > >') and 'Vector_d, CGAL::Linear_algebraHd<__gmp_expr, std::allocator<__gmp_expr > > > >') CGAL_TEST(v.transform(at9)==3*v){} ~~~~~~~~~~~~~~~~^ ~~~ /home/cgal_tester/build/src/cmake/platforms/ArchLinux-clang-CXX20-Release/test/Kernel_d/include/CGAL/test_macros.h:10:28: note: expanded from macro 'CGAL_TEST' ^ /mnt/testsuite/include/CGAL/Kernel_d/VectorHd.h:350:6: note: candidate function bool operator==(const VectorHd& w) const ^ /mnt/testsuite/include/CGAL/Kernel_d/Vector_d.h:90:8: note: candidate function (with reversed parameter order) bool operator==(const Self& w) const ^ ``` ``` /home/cgal_tester/build/src/cmake/platforms/ArchLinux-clang-CXX20-Release/test/Kernel_d/afftrafo-test.cpp:141:33: error: use of overloaded operator '==' is ambiguous (with operand types 'DirectionHd, CGAL::Linear_algebraHd<__gmp_expr, std::allocator<__gmp_expr > > >::RT, CGAL::DirectionHd<__gmp_expr, CGAL::Linear_algebraHd<__gmp_expr, std::allocator<__gmp_expr > > >::LA>' (aka 'DirectionHd<__gmp_expr, CGAL::Linear_algebraHd<__gmp_expr, std::allocator<__gmp_expr > > >') and 'Direction' (aka 'Direction_d > >')) CGAL_TEST(dir.transform(at9)==dir){} ~~~~~~~~~~~~~~~~~~^ ~~~ /home/cgal_tester/build/src/cmake/platforms/ArchLinux-clang-CXX20-Release/test/Kernel_d/include/CGAL/test_macros.h:10:28: note: expanded from macro 'CGAL_TEST' ^ /mnt/testsuite/include/CGAL/Kernel_d/DirectionHd.h:181:6: note: candidate function bool operator==(const DirectionHd& w) const ^ /mnt/testsuite/include/CGAL/Kernel_d/Direction_d.h:61:8: note: candidate function (with reversed parameter order) bool operator==(const Self& w) const ^ ``` --- Kernel_d/include/CGAL/Kernel_d/Direction_d.h | 4 ++++ Kernel_d/include/CGAL/Kernel_d/Vector_d.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Kernel_d/include/CGAL/Kernel_d/Direction_d.h b/Kernel_d/include/CGAL/Kernel_d/Direction_d.h index 4cef344f845..70bd4c1b725 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Direction_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Direction_d.h @@ -62,6 +62,10 @@ class Direction_d : public pR::Direction_d_base { return Base::operator==(w); } bool operator!=(const Self& w) const { return Base::operator!=(w); } + bool operator==(const Base& w) const + { return Base::operator==(w); } + bool operator!=(const Base& w) const + { return Base::operator!=(w); } }; } //namespace CGAL diff --git a/Kernel_d/include/CGAL/Kernel_d/Vector_d.h b/Kernel_d/include/CGAL/Kernel_d/Vector_d.h index f434e579f6b..ffd79e265ba 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Vector_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Vector_d.h @@ -91,6 +91,10 @@ class Vector_d : public pR::Vector_d_base { return Base::operator==(w); } bool operator!=(const Self& w) const { return Base::operator!=(w); } + bool operator==(const Base& w) const + { return Base::operator==(w); } + bool operator!=(const Base& w) const + { return Base::operator!=(w); } };