Hello, Given the following code: ``` #define _GLIBCXX_DEBUG 1 #include <bitset> std::bitset<3> a, b; bool test = (a == b); ``` clang gives the following error: ``` $ clang++ -c foo.cpp -std=c++20 In file included from foo.cpp:2: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bitset:1595: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/debug/bitset:356:26: error: use of overloaded operator '==' is ambiguous (with operand types 'const std::__debug::bitset<3>::_Base' (aka 'const bitset<3UL>') and 'const bitset<3UL>' (aka 'const std::__debug::bitset<3>')) { return _M_base() == __rhs; } ~~~~~~~~~ ^ ~~~~~ foo.cpp:5:16: note: in instantiation of member function 'std::__debug::bitset<3>::operator==' requested here bool test = (a == b); ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bitset:1306:7: note: candidate function operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/debug/bitset:355:7: note: candidate function (with reversed parameter order) operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT ^ 1 error generated ``` g++ does not, but I guess this still warrants checking ?
gcc.godbolt.org link for easy repro: https://gcc.godbolt.org/z/WYbzfT
I'd wager this is a result of C++20 operator<=> changes and operator== synthesis.
Already fixed. *** This bug has been marked as a duplicate of bug 96303 ***
(In reply to Jean-Michaël Celerier from comment #0) > g++ does not, but I guess this still warrants checking ? N.B. GCC does give an error if you compile with -Wpedantic -std=c++20