]> gcc.gnu.org Git - gcc.git/commit
c++: lambda pack init-capture within generic lambda
authorJason Merrill <jason@redhat.com>
Fri, 2 Apr 2021 15:05:46 +0000 (11:05 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 2 Apr 2021 16:46:54 +0000 (12:46 -0400)
commit2a26351b598242c2fbce95d2a0baacce0084aec6
tree5eee86e5ccc2ea0657eeec2543dce1913473296c
parentf4e05eebd6aac6118cbd9e0a04c011b6ed682826
c++: lambda pack init-capture within generic lambda

We represent the type of a pack init-capture as auto... with packs from the
initializer stuck into PACK_EXPANSION_PARAMETER_PACKS so that expanding it
produces the right number of elements.  But when partially instantiating the
auto..., we were changing PACK_EXPANSION_PARAMETER_PACKS to refer to only
the auto itself.  Fixed thus.

gcc/cp/ChangeLog:

PR c++/97938
* cp-tree.h (PACK_EXPANSION_AUTO_P): New.
* lambda.c (add_capture): Set it.
* pt.c (tsubst_pack_expansion): Handle it.

gcc/testsuite/ChangeLog:

PR c++/97938
* g++.dg/cpp2a/lambda-pack-init6.C: New test.
gcc/cp/cp-tree.h
gcc/cp/lambda.c
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C [new file with mode: 0644]
This page took 0.058214 seconds and 6 git commands to generate.