c++: generic lambda forwarding function [PR94546]
authorJason Merrill <jason@redhat.com>
Wed, 22 Apr 2020 06:27:54 +0000 (02:27 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 22 Apr 2020 06:27:55 +0000 (02:27 -0400)
commitaedd04caa945260ea77fd22f29b77292f7dba72e
treed4cae8c16debd115b4d80c2e9f01f050c9b2c64b
parent587970215f4681def390e2a791aa3ba6adb65158
c++: generic lambda forwarding function [PR94546]

While instantiating test(Plot) we partially instantiate the generic lambda.
We look at forward<T>(rest)... and see that it's just replacing parameter
packs with new parameter packs and tries to do a direct substitution.  But
because register_parameter_specializations had built up a
NONTYPE_ARGUMENT_PACK around the new parameter pack, the substitution
failed.  So let's not wrap it that way.

gcc/cp/ChangeLog
2020-04-22  Jason Merrill  <jason@redhat.com>

PR c++/94546
* pt.c (register_parameter_specializations): If the instantiation is
still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
(tsubst_pack_expansion, tsubst_expr): Adjust.
gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp2a/lambda-generic-variadic20.C [new file with mode: 0644]