From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C77EB3858C39; Tue, 28 Feb 2023 15:11:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C77EB3858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677597060; bh=8MvqLrrguz1e+AMPMpHMArdmbmoyVwAbDFDnXGZeJeQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eW0EeVX0mXe5e08LZn8/nkszUGEfv5EVlg6G5gpBrtMhN0gSGxhV3I5D0x73xV+gu TAyAcHkPxBRFFXQ7wRx9/Ft1VgWDYEQ77icWmlQn5r3JqYDWZeejrKdwTButbA/KUN 1S1kjaV522OFrFHxNhbxA4Iaoiwq4BUZXqdI7o1Y= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107938] [11/12/13 Regression] ICE directly returning `this` of `extern` variable in template since r11-557 Date: Tue, 28 Feb 2023 15:10:59 +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, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107938 --- Comment #5 from CVS Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:ea718febab2a1f6e58806738abf70f1c73c6a308 commit r13-6376-gea718febab2a1f6e58806738abf70f1c73c6a308 Author: Marek Polacek Date: Thu Feb 23 17:54:47 2023 -0500 c++: ICE with constexpr variable template [PR107938] Since r11-557, cp_finish_decl can call check_initializer even in a template for a constexpr initializer. That ultimately leads to convert_for_assignment and check_address_or_pointer_of_packed_member, where we crash, because it doesn't expect that the CALL_EXPR is a function object. Q has a constexpr operator(), but since we're in a template, q(0) is a CALL_EXPR whose CALL_EXPR_FN is just a VAR_DECL; it hasn't been converted to Q::operator(&q, 0) yet. I propose to robustify check_address_or_pointer_of_packed_member. var-templ74.C has an XFAIL, subject to 107939. I noticed that our -Waddress-of-packed-member tests weren't testing member functions, added thus. (I was tempted to check FUNCTION_POINTER_TYPE_P but that doesn't include METHOD_TYPE.) PR c++/107938 gcc/c-family/ChangeLog: * c-warn.cc (check_address_or_pointer_of_packed_member): Check POINTER_TYPE_P. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/var-templ73.C: New test. * g++.dg/cpp1y/var-templ74.C: New test. * g++.dg/warn/Waddress-of-packed-member3.C: New test.=