From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7FB083858C30; Wed, 1 Mar 2023 09:25:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FB083858C30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677662754; bh=r0t8wUls6zzeocDJBkI4UJ0DO3zoegYrU5LzJqJ2npU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Lg9yu8BV1revSlOJ8slOX5ao8JOvshcELOZgWbngO42FaQdxvsFAcBxP6FMiY4YCC w4F3aDziHMs1CA+twNXAnV/ZjfixMw6uaRDnLQDi1+k45Mr0XNT7A6jgPOPnvVqsdY kry8i8EbNDmQL7byJy2eBhTeUuNkOlqDV7LKTNCs= From: "cvs-commit at gcc dot 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 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: c++-lambda, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108606 --- Comment #6 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:b222e725f53231a0bd9799ca93892a79d592a5f3 commit r13-6387-gb222e725f53231a0bd9799ca93892a79d592a5f3 Author: Jakub Jelinek 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 pa= tch 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 PR c++/108606 * constexpr.cc (potential_constant_expression_1) : Only recurse on DECL_INITIAL (tmp) if tmp is a VAR_DECL, otherw= ise just return true. * g++.dg/cpp1y/pr108606.C: New test.=