c++: lambda template in requires [PR105541]
authorJason Merrill <jason@redhat.com>
Wed, 11 May 2022 18:53:26 +0000 (14:53 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 1 Jul 2022 14:55:45 +0000 (10:55 -0400)
commitb1c8ee2627696717013ebdb1ca3f5f97a76b1cb9
treea46a0b919420c2ea5592cbca335bc6e31a277791
parentd9130880f77c7f9ffd5deaabda605bc151521be5
c++: lambda template in requires [PR105541]

Since the patch for PR103408, the template parameters for the lambda in this
test have level 1 instead of 2, and we were treating null template args as 1
level of arguments, so tsubst_template_parms decided it had nothing to do.
Fixed by distinguishing between <> and no args at all, which is what we have
in our "substitution" in a requires-expression.

PR c++/105541

gcc/cp/ChangeLog:

* cp-tree.h (TMPL_ARGS_DEPTH): 0 for null args.
* parser.cc (cp_parser_enclosed_template_argument_list):
Use 0-length TREE_VEC for <>.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-requires1.C: New test.
gcc/cp/cp-tree.h
gcc/cp/parser.cc
gcc/testsuite/g++.dg/cpp2a/lambda-requires1.C [new file with mode: 0644]