From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 97A20385AE5A; Thu, 16 Jun 2022 15:36:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97A20385AE5A From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105996] [10/11/12/13 Regression] reinterpret_cast in constexpr failure creating a pair with a function pointer of class parent Date: Thu, 16 Jun 2022 15:36:40 +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: 12.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cc 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: Thu, 16 Jun 2022 15:36:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105996 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- The problem is that build_ptrmemfunc in 9587 if (TREE_CODE (pfn) !=3D PTRMEM_CST) 9588 { 9589 if (same_type_p (to_type, pfn_type)) 9590 return pfn; 9591 else if (integer_zerop (n) && TREE_CODE (pfn) !=3D CONSTR= UCTOR) 9592 return build_reinterpret_cast (input_location, to_type, pfn,=20 9593 complain); 9594 } calls build_reintepret_cast from void (A::*)() typed pfn to void (B::*)() t= ype, and when we then constant expression evaluate it, we reject it because reinterpret_cast is not a core constant expression as per https://eel.is/c++draft/expr.const#5.16 Now, is this reinterpret cast just some implementation detail under the hoo= d in which we should somehow arrange for REINTERPRET_CAST_P bit not be set (or afterwards remove it)?=