public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98712] New: Incorrect defaulted operator== at compile time and runtime when declared constexpr and inheriting
@ 2021-01-17 18:31 ryan_greenblatt at brown dot edu
  2021-01-18  2:50 ` [Bug c++/98712] Incorrect defaulted operator== at compile time and runtime when declared constexpr and inheriting (c++20) ryan_greenblatt at brown dot edu
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ryan_greenblatt at brown dot edu @ 2021-01-17 18:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98712

            Bug ID: 98712
           Summary: Incorrect defaulted operator== at compile time and
                    runtime when declared constexpr and inheriting
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan_greenblatt at brown dot edu
  Target Milestone: ---

```
struct IntHolder {
  int v;
  bool operator==(const IntHolder &) const = default;
};

struct Inherits : IntHolder {
  // without constexpr here the issue goes away...
  constexpr bool operator==(const Inherits &) const = default;
};

#if 0
static_assert(Inherits{1} != Inherits{2});
#else
#include <iostream>

int main() {
  // should output true...
  volatile int l = 1;
  std::cout << std::boolalpha << (Inherits{l} != Inherits{2}) << std::endl;
}
#endif
```
https://godbolt.org/z/145dbq

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

end of thread, other threads:[~2022-11-03 21:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-17 18:31 [Bug c++/98712] New: Incorrect defaulted operator== at compile time and runtime when declared constexpr and inheriting ryan_greenblatt at brown dot edu
2021-01-18  2:50 ` [Bug c++/98712] Incorrect defaulted operator== at compile time and runtime when declared constexpr and inheriting (c++20) ryan_greenblatt at brown dot edu
2021-01-19  1:49 ` ppalka at gcc dot gnu.org
2021-05-31 16:44 ` ppalka at gcc dot gnu.org
2021-08-12 18:10 ` ppalka at gcc dot gnu.org
2021-08-12 19:16 ` jakub at gcc dot gnu.org
2021-10-06  2:41 ` cvs-commit at gcc dot gnu.org
2022-03-05  4:45 ` pinskia at gcc dot gnu.org
2022-11-03 21:17 ` ppalka 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).