From: Jason Merrill Date: Wed, 25 May 2022 16:55:26 +0000 (-0400) Subject: Revert "c++: pack init-capture of unresolved overload [PR102629]" X-Git-Tag: releases/gcc-10.4.0~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bea4429004b02b834c6a15dcc3bfbd953b230585;p=thirdparty%2Fgcc.git Revert "c++: pack init-capture of unresolved overload [PR102629]" PR c++/105722 This reverts commit 93ec7bf22530610ef697fd3a64a28bebd589c790. --- diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ab41af4aaca2..0a52f0993abd 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12438,13 +12438,7 @@ gen_elem_of_pack_expansion_instantiation (tree pattern, t = tsubst_expr (pattern, args, complain, in_decl, /*integral_constant_expression_p=*/false); else - { - t = tsubst (pattern, args, complain, in_decl); - if (is_auto (t) && !ith_elem_is_expansion) - /* When expanding the fake auto... pack expansion from add_capture, we - need to mark that the expansion is no longer a pack. */ - TEMPLATE_TYPE_PARAMETER_PACK (t) = false; - } + t = tsubst (pattern, args, complain, in_decl); /* If the Ith argument pack element is a pack expansion, then the Ith element resulting from the substituting is going to diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init7.C b/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init7.C deleted file mode 100644 index f3c3899e97a1..000000000000 --- a/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init7.C +++ /dev/null @@ -1,18 +0,0 @@ -// PR c++/102629 -// { dg-do compile { target c++20 } } - -template T&& forward(T&); -template T&& forward(T&&); - -struct S {}; - -template -void foo(Args&&... args) { - [...args = forward /*(args)*/] { // { dg-error "" } - [](auto...) { } (forward(args)...); - }; -} - -void bar( ) { - foo(S{}); -}