public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jeanmichael.celerier at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/96816] New: bitset: debug mode: operator== ambiguous
Date: Thu, 27 Aug 2020 12:28:36 +0000	[thread overview]
Message-ID: <bug-96816-4@http.gcc.gnu.org/bugzilla/> (raw)

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 ?

             reply	other threads:[~2020-08-27 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 12:28 jeanmichael.celerier at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96816-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).