public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101888] New: constexpr default comparison member function disregards the base class
@ 2021-08-12 18:04 myosotis at mail dot ustc.edu.cn
2021-08-12 18:10 ` [Bug c++/101888] " ppalka at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: myosotis at mail dot ustc.edu.cn @ 2021-08-12 18:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101888
Bug ID: 101888
Summary: constexpr default comparison member function
disregards the base class
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: myosotis at mail dot ustc.edu.cn
Target Milestone: ---
This issue only occurs when the default operator== in the derived class is a
constexpr member function (non-constexpr or friend operator== won't trigger
this issue). Whether the operator== function in the base class is constexpr
member or not does not matter. I tested on gcc 11.1 and 11.2, and this issue
persists whatever the optimization level is. Repro:
struct S
{
int s = 0;
S(int s) : s(s) {}
bool operator==(const S&) const = default;
};
struct T : S
{
T(int s) : S(s) {}
constexpr bool operator==(const T&) const = default;
};
int main() { return T(0) == T(1); } // Expected 0, but returns 1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/101888] constexpr default comparison member function disregards the base class
2021-08-12 18:04 [Bug c++/101888] New: constexpr default comparison member function disregards the base class myosotis at mail dot ustc.edu.cn
@ 2021-08-12 18:10 ` ppalka at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-08-12 18:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101888
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
CC| |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Thanks for the bug report, this looks like a dup of PR98712
*** This bug has been marked as a duplicate of bug 98712 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-12 18:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 18:04 [Bug c++/101888] New: constexpr default comparison member function disregards the base class myosotis at mail dot ustc.edu.cn
2021-08-12 18:10 ` [Bug c++/101888] " 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).