From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 82A063858C55; Mon, 9 May 2022 17:11:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82A063858C55 From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105529] [13 Regression] cxx_eval_store_expression on arm because of ctor returning this since r13-160-g967cdbe6629653 Date: Mon, 09 May 2022 17:11:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to Message-ID: In-Reply-To: References: 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: Mon, 09 May 2022 17:11:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105529 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot= gnu.org --- Comment #3 from Marek Polacek --- Therefore, a potential fix would be: --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -5916,8 +5916,9 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, = tree t, gcc_checking_assert (!*valp || (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (*valp), type))); - if (empty_base || !(same_type_ignoring_top_level_qualifiers_p - (TREE_TYPE (init), type))) + if (empty_base || (CLASS_TYPE_P (TREE_TYPE (init)) + && !(same_type_ignoring_top_level_qualifiers_p + (TREE_TYPE (init), type)))) { /* For initialization of an empty base, the original target will be *(base*)this, evaluation of which resolves to the object This code expects code like D.2181 =3D {} where the type of the LHS is the derived type and the type of the RHS is the base type.=