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++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
Date: Wed, 01 Mar 2023 09:25:53 +0000	[thread overview]
Message-ID: <bug-108606-4-Ex7gZTu8CY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108606-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108606

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:b222e725f53231a0bd9799ca93892a79d592a5f3

commit r13-6387-gb222e725f53231a0bd9799ca93892a79d592a5f3
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 1 10:22:59 2023 +0100

    c++: Don't recurse on DECL_INITIAL for DECL_EXPR on non-VAR_DECLs
[PR108606]

    The r13-2965-g73d9b0e5947e16 change changed the line touched in this patch
    from
          return RECUR (tmp, want_rval);
    to
          return RECUR (DECL_INITIAL (tmp), want_rval);
    This is on DECL_EXPR handling code, where tmp can be lots of different
    trees and DECL_INITIAL unfortunately also means different things on
    different trees.
    It is the initializer on VAR_DECL, DECL_ARG_TYPE on PARM_DECLs (though
    those are unlikely to have DECL_EXPRs), for FUNCTION_DECLs the body,
    ..., USING_DECL_DECLS on USING_DECLs and DECL_FRIENDLIST on TYPE_DECLs.

    The testcase below ICEs because we have a DECL_EXPR for TYPE_DECL
    which has non-NULL DECL_FRIENDLIST and we certainly can't recurse on
    the friend list.

    The following patch will RECUR on DECL_INITIAL only for VAR_DECLs and
    for anything else just return true.

    2023-03-01  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108606
            * constexpr.cc (potential_constant_expression_1) <case DECL_EXPR>:
            Only recurse on DECL_INITIAL (tmp) if tmp is a VAR_DECL, otherwise
            just return true.

            * g++.dg/cpp1y/pr108606.C: New test.

  parent reply	other threads:[~2023-03-01  9:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
2023-01-30 20:13 ` [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda pinskia at gcc dot gnu.org
2023-01-30 20:13 ` pinskia at gcc dot gnu.org
2023-01-31 15:22 ` mpolacek at gcc dot gnu.org
2023-01-31 15:25 ` mpolacek at gcc dot gnu.org
2023-02-21 12:51 ` rguenth at gcc dot gnu.org
2023-02-21 13:25 ` jakub at gcc dot gnu.org
2023-02-21 13:48 ` jakub at gcc dot gnu.org
2023-03-01  9:25 ` cvs-commit at gcc dot gnu.org [this message]
2023-03-01  9:28 ` jakub 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-108606-4-Ex7gZTu8CY@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: link
Be 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).