From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DE23838937EC; Thu, 15 Dec 2022 20:54:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE23838937EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671137683; bh=jovbRqSagzxGWoLWCcsijX3fphhs7xtnX/OEA+8mGsg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DhLI765VDtoWlPVHoEqS3c6obUZ7s3ENfGcxlj8SJARb02S6rD+Cl+j9vtQsmAHJ/ kfNiVJ10cDtUkipGjS/U1iu/VFa/dWdmrLOXkg44lbVrS0wZ+Q6RxolYph1TytXsOY 4MqUftPlNZ+QdTD/wsTi9rQLqbzgV/2syHv3R2JI= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105518] [rejects valid] nested lambda using an outer type alias fails with constexpr integer in that alias Date: Thu, 15 Dec 2022 20:54:43 +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, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D105518 --- Comment #2 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:be124477b38a71ba8ba0b24d859ae764bb44a4eb commit r13-4729-gbe124477b38a71ba8ba0b24d859ae764bb44a4eb Author: Patrick Palka Date: Thu Dec 15 15:54:31 2022 -0500 c++: local alias in typename in lambda [PR105518] We substitute the qualifying scope of a TYPENAME_TYPE directly using tsubst_aggr_type (so that we can pass entering_scope=3Dtrue) instead of going through tsubst, which means we don't properly reuse typedefs during this substitution. This ends up causing us to reject the below testcase because we substitute the TYPENAME_TYPE alias::type as if it were written without the A alias, and thus we expect the non-capturi= ng lambda to capture t. This patch fixes this by making tsubst_aggr_type delegate typedefs to tsubst so that get consistently reused, and then adjusting the result appropriately if entering_scope is true. In passing, this refactors tsubst_aggr_type into two functions, one that's intended to be called directly and a more minimal one that's intended to be called only from the RECORD/UNION/ENUMERAL_TYPE cases of tsubst (and contains only the necessary bits for that call site). PR c++/105518 gcc/cp/ChangeLog: * pt.cc (tsubst_aggr_type): Handle typedefs by delegating to tsubst and adjusting the result if entering_scope. Split out the main part of the function into ... (tsubst_aggr_type_1) ... here. (tsubst): Use tsubst_aggr_type_1 instead of tsubst_aggr_type. Handle TYPE_PTRMEMFUNC_P RECORD_TYPEs here instead of in tsubst_aggr_type_1. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-alias1.C: New test.=