c++: lambda in non-type template parm type [PR99478]
authorJason Merrill <jason@redhat.com>
Wed, 14 Apr 2021 02:28:32 +0000 (22:28 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 14 Apr 2021 02:35:14 +0000 (22:35 -0400)
commite1666ebd9ad31dbd8b9b933c883bdd882cfd1522
tree50b0a965cfcd7ae9f3ccc3b08cfa4f27c7aa8d43
parent0589be0c59767cf4cbb0ef0e7d918cf6aa3d606c
c++: lambda in non-type template parm type [PR99478]

In this testcase, the non-type template parameter has the type of a
lambda-expression.  This makes no sense because a lambda in template context
is specified to be distinct between different specializations of the
template, even if the lambda is non-dependent, but here which specialization
we are dealing with depends on which lambda we have, and vice versa.

gcc/cp/ChangeLog:

PR c++/99478
* parser.c (cp_parser_lambda_expression): Reject lambda
in template parameter type.

gcc/testsuite/ChangeLog:

PR c++/99478
* g++.dg/cpp2a/lambda-uneval14.C: New test.
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C [new file with mode: 0644]