https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96816
Bug ID: 96816 Summary: bitset: debug mode: operator== ambiguous Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: jeanmichael.celerier at gmail dot com Target Milestone: --- 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 ?