public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107938] [11/12 Regression] ICE directly returning `this` of `extern` variable in template since r11-557 Date: Sat, 04 Mar 2023 17:43:46 +0000 [thread overview] Message-ID: <bug-107938-4-wGmSQgrQ2B@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107938-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107938 --- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:445082ff3cb7f9d30021adf338e9ab6038c3e412 commit r12-9215-g445082ff3cb7f9d30021adf338e9ab6038c3e412 Author: Marek Polacek <polacek@redhat.com> 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<int>(&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. (cherry picked from commit ea718febab2a1f6e58806738abf70f1c73c6a308)
next prev parent reply other threads:[~2023-03-04 17:43 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-30 19:09 [Bug c++/107938] New: ICE directly returning `this` of `extern` variable in template johelegp at gmail dot com 2022-11-30 19:23 ` [Bug c++/107938] [11/12/13 Regression] " pinskia at gcc dot gnu.org 2022-11-30 19:30 ` pinskia at gcc dot gnu.org 2022-12-01 8:03 ` rguenth at gcc dot gnu.org 2022-12-02 14:52 ` [Bug c++/107938] [11/12/13 Regression] ICE directly returning `this` of `extern` variable in template since r11-557 jakub at gcc dot gnu.org 2023-02-13 18:09 ` mpolacek at gcc dot gnu.org 2023-02-23 23:52 ` mpolacek at gcc dot gnu.org 2023-02-28 15:10 ` cvs-commit at gcc dot gnu.org 2023-03-04 17:43 ` cvs-commit at gcc dot gnu.org [this message] 2023-03-04 18:24 ` [Bug c++/107938] [11/12 " mpolacek at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107938-4-wGmSQgrQ2B@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).