public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/96816] New: bitset: debug mode: operator== ambiguous
@ 2020-08-27 12:28 jeanmichael.celerier at gmail dot com
  2020-08-27 12:29 ` [Bug libstdc++/96816] " jeanmichael.celerier at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jeanmichael.celerier at gmail dot com @ 2020-08-27 12:28 UTC (permalink / raw)
  To: gcc-bugs

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 ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-27 12:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 12:28 [Bug libstdc++/96816] New: bitset: debug mode: operator== ambiguous jeanmichael.celerier at gmail dot com
2020-08-27 12:29 ` [Bug libstdc++/96816] " jeanmichael.celerier at gmail dot com
2020-08-27 12:30 ` jeanmichael.celerier at gmail dot com
2020-08-27 12:37 ` redi at gcc dot gnu.org
2020-08-27 12:43 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).