From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 230663850200; Fri, 17 Mar 2023 23:33:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 230663850200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679095987; bh=C7HkUv1aQwpsQkgql43mKqGGy0Pg1uDqpLtx6+bM+U4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=A/+ERgRaIA/kVoGI56B2NSmmh4aGoUashkVfs29kBsEWpkLEUOi3Vq7aKQSU5OBxB Oj3ZDoefJ+g/Qd2LTamJyafEBuopY/46nDGqNIBp3uZsm/NkKqmimJVjVM/N1znK5i 4gRoTbIIZurJa0f9/eBPIzlInk0fB0WQ2GTgN3xg= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108975] [10/11/12/13 Regression] ICE on constexpr variable used as nontype template since r9-5473-ge32fc4499f863f Date: Fri, 17 Mar 2023 23:33:04 +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 #13 from CVS Commits --- The trunk branch has been updated by Jason Merrill : https://gcc.gnu.org/g:6f90de97634d6f1617a054429f28b85fbfbd8b6f commit r13-6743-g6f90de97634d6f1617a054429f28b85fbfbd8b6f 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.=