From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 99F5B387088E; Tue, 18 Apr 2023 20:46:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99F5B387088E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681850783; bh=us3mPLNl57h6Dpr4J2bNa6qXuWofuRz1Ci0oAbPPUMk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Am0PKHpOb3wYmwBwdwyGMkCK1mKr+UjKYzx4omRcoYdK4xk/4keECMGmL+VQvwEmY LtFugPl7L30gs6kUI3xEe6p+6hUrsgTigAObk9C+Rd2gj7RvY0ZodZEuu7PQvIYifz e4m4f3G0Sh8EpJDEZ4BGsH2fbh57B40C0Q8qatOA= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108975] [10/11/12 Regression] ICE on constexpr variable used as nontype template since r9-5473-ge32fc4499f863f Date: Tue, 18 Apr 2023 20:46:22 +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: c++-lambda, ice-on-valid-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: P2 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 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=3D108975 --- Comment #14 from CVS Commits --- The releases/gcc-12 branch has been updated by Jason Merrill : https://gcc.gnu.org/g:55ab4606ab1084a55d53184c5cf4543740a7f65d commit r12-9440-g55ab4606ab1084a55d53184c5cf4543740a7f65d Author: Jason Merrill Date: Fri Mar 17 17:26:40 2023 -0400 c++: constant, array, lambda, template [PR108975] When a lambda refers to a constant local variable in the enclosing scop= e, we tentatively capture it, but if we end up pulling out its constant value= , we go back at the end of the lambda and prune any unneeded captures. Here while parsing the template we decided that the dim capture was unneeded, because we folded it away, but then we brought back the use in the temp= late trees that try to preserve the source representation with added type in= fo. So then when we tried to instantiate that use, we couldn't find what it= was trying to use, and crashed. Fixed by not trying to prune when parsing a template; we'll prune at instantiation time. PR c++/108975 gcc/cp/ChangeLog: * lambda.cc (prune_lambda_captures): Don't bother in a template. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-const11.C: New test.=