From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A03593858C50; Wed, 28 Jun 2023 19:44:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A03593858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687981447; bh=LgB90pjo2SAQaM1J7OrADojmq/HC6N9Ehn95BWWMTkY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rXxFx3kKF3FvB7yzhSEH0jKQbO0nsMoe+zxOp/JxQBOyusOkrcmvBxRFG9NflhbPZ DLgC/7CXxeCPYtmGYnTFgr7mgT4b+w9GmjgKpiLtipd3vJMGnKCuDBA7v3+JiIvUYB TRW66Og2QeZ0eicPdD7PJkfnoe7XSm4iLlvFBx3k= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107437] nested generic lambdas fail requiring unneded captures Date: Wed, 28 Jun 2023 19:44:06 +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.2.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: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka 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=3D107437 --- Comment #6 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:4cf64d9cc2faf4001f037a50a350abd0f95f3e29 commit r14-2170-g4cf64d9cc2faf4001f037a50a350abd0f95f3e29 Author: Patrick Palka Date: Wed Jun 28 15:43:33 2023 -0400 c++: ahead of time variable template-id coercion [PR89442] This patch makes us coerce the arguments of a variable template-id ahead of time, as we do for class template-ids, which causes us to immediately diagnose template parm/arg kind mismatches and arity mismatches. Unfortunately this causes a regression in cpp1z/constexpr-if20.C: coerc= ing the variable template-id m ahead of time means we strip it of typedefs, yielding m::q, typename C::q>, but in this stripped form we're directly using 'i' and so we expect to have captured it. This is a variable template version of PR107437. PR c++/89442 PR c++/107437 gcc/cp/ChangeLog: * cp-tree.h (lookup_template_variable): Add complain parameter. * parser.cc (cp_parser_template_id): Pass tf_warning_or_error to lookup_template_variable. * pt.cc (lookup_template_variable): Add complain parameter. Coerce template arguments here ... (finish_template_variable): ... instead of here. (lookup_and_finish_template_variable): Check for error_mark_node result from lookup_template_variable. (tsubst_copy) : Pass complain to lookup_template_variable. (instantiate_template): Use build2 instead of lookup_template_variable to build a TEMPLATE_ID_EXPR for most_specialized_partial_spec. gcc/testsuite/ChangeLog: * g++.dg/cpp/pr64127.C: Expect "expected unqualified-id at end of input" error. * g++.dg/cpp0x/alias-decl-ttp1.C: Fix template parameter/argume= nt kind mismatch for variable template has_P_match_V. * g++.dg/cpp1y/pr72759.C: Expect "template argument 1 is invali= d" error. * g++.dg/cpp1z/constexpr-if20.C: XFAIL test due to bogus "'i' is not captured" error. * g++.dg/cpp1z/noexcept-type21.C: Fix arity of variable templat= e d. * g++.dg/diagnostic/not-a-function-template-1.C: Add default template argument to variable template A so that A<> is valid. * g++.dg/parse/error56.C: Don't expect "ISO C++ forbids declaration with no type" error. * g++.dg/parse/template30.C: Don't expect "parse error in template argument list" error. * g++.dg/cpp1y/var-templ82.C: New test.=