c++: lambda in default type template-argument [PR100091]
My patch for 99478 relied on local_variables_forbidden_p for distinguishing between a template parameter and its default argument, but that flag wasn't set for a default type template-argument. gcc/cp/ChangeLog: PR c++/100091 PR c++/99478 * parser.c (cp_parser_default_type_template_argument): Set parser->local_variables_forbidden_p. gcc/testsuite/ChangeLog: PR c++/100091 * g++.dg/cpp2a/lambda-uneval15.C: New test.
This commit is contained in:
parent
6c0c7fc623
commit
432f60c90d
|
@ -16923,6 +16923,10 @@ cp_parser_default_type_template_argument (cp_parser *parser)
|
|||
|
||||
cp_token *token = cp_lexer_peek_token (parser->lexer);
|
||||
|
||||
/* Tell cp_parser_lambda_expression this is a default argument. */
|
||||
auto lvf = make_temp_override (parser->local_variables_forbidden_p);
|
||||
parser->local_variables_forbidden_p = LOCAL_VARS_AND_THIS_FORBIDDEN;
|
||||
|
||||
/* Parse the default-argument. */
|
||||
push_deferring_access_checks (dk_no_deferred);
|
||||
tree default_argument = cp_parser_type_id (parser,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// PR c++/100091
|
||||
// { dg-do compile { target c++20 } }
|
||||
|
||||
template<typename = decltype([]{})>
|
||||
void f() {}
|
Loading…
Reference in New Issue