From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A9FB5386F036; Sun, 17 Jan 2021 18:31:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9FB5386F036 From: "ryan_greenblatt at brown dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98712] New: Incorrect defaulted operator== at compile time and runtime when declared constexpr and inheriting Date: Sun, 17 Jan 2021 18:31:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ryan_greenblatt at brown dot edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jan 2021 18:31:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98712 Bug ID: 98712 Summary: Incorrect defaulted operator=3D=3D 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=3D=3D(const IntHolder &) const =3D default; }; struct Inherits : IntHolder { // without constexpr here the issue goes away... constexpr bool operator=3D=3D(const Inherits &) const =3D default; }; #if 0 static_assert(Inherits{1} !=3D Inherits{2}); #else #include int main() { // should output true... volatile int l =3D 1; std::cout << std::boolalpha << (Inherits{l} !=3D Inherits{2}) << std::end= l; } #endif ``` https://godbolt.org/z/145dbq=