From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 02815388C015; Mon, 8 Mar 2021 13:30:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02815388C015 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99456] [11 regression] ABI breakage with some static initialization Date: Mon, 08 Mar 2021 13:30:23 +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: 11.0 X-Bugzilla-Keywords: ABI, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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, 08 Mar 2021 13:30:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99456 --- Comment #6 from Jakub Jelinek --- Another thing is that perhaps we should be rejecting reinterpret_cast only = in the pedantic constant expression evaluation mode, not when we allow extensions = and fold as much as we can. So something like (incremental): --- gcc/cp/constexpr.c 2021-03-08 13:08:49.944229227 +0100 +++ gcc/cp/constexpr.c 2021-03-08 14:23:01.263716186 +0100 @@ -6629,11 +6629,9 @@ case NOP_EXPR: case CONVERT_EXPR: - if (REINTERPRET_CAST_P (t)) + if (REINTERPRET_CAST_P (t) && !ctx->quiet) { - if (!ctx->quiet) - error_at (loc, - "% is not a constant expression"); + error_at (loc, "% is not a constant expression= "); *non_constant_p =3D true; return t; } @@ -8103,13 +8101,6 @@ case NOP_EXPR: case CONVERT_EXPR: - if (REINTERPRET_CAST_P (t)) - { - if (flags & tf_error) - error_at (loc, "% is not a constant expression"); - return false; - } - /* FALLTHRU */ case VIEW_CONVERT_EXPR: /* -- a reinterpret_cast. FIXME not implemented, and this rule may change to something more specific to type-punning (DR 1312). = */ But that doesn't make these inline vars statically initialized either, real= ly confused on what's going on.=