static void cp_parser_type_specifier_seq
(cp_parser *, cp_parser_flags, bool, bool, cp_decl_specifier_seq *);
static tree cp_parser_parameter_declaration_clause
- (cp_parser *, cp_parser_flags);
+ (cp_parser *, cp_parser_flags, bool);
static tree cp_parser_parameter_declaration_list
(cp_parser *, cp_parser_flags, auto_vec<tree> *);
static cp_parameter_declarator *cp_parser_parameter_declaration
/* Parse parameters. */
param_list
= cp_parser_parameter_declaration_clause
- (parser, CP_PARSER_FLAGS_TYPENAME_OPTIONAL);
+ (parser, CP_PARSER_FLAGS_TYPENAME_OPTIONAL, /*lambda_p=*/true);
/* Default arguments shall not be specified in the
parameter-declaration-clause of a lambda-declarator. */
/* Parse the parameter-declaration-clause. */
params
- = cp_parser_parameter_declaration_clause (parser, flags);
+ = cp_parser_parameter_declaration_clause (parser, flags,
+ /*lambda_p=*/false);
const location_t parens_end
= cp_lexer_peek_token (parser->lexer)->location;
The parser flags FLAGS is used to control type-specifier parsing.
+ LAMBDA_P is true if this is the parameter-declaration-clause of
+ a lambda-declarator.
+
Returns a representation for the parameter declarations. A return
value of NULL indicates a parameter-declaration-clause consisting
only of an ellipsis. */
static tree
cp_parser_parameter_declaration_clause (cp_parser* parser,
- cp_parser_flags flags)
+ cp_parser_flags flags,
+ bool lambda_p)
{
tree parameters;
cp_token *token;
auto cleanup = make_temp_override
(parser->auto_is_implicit_function_template_parm_p);
- if (!processing_specialization
- && !processing_template_parmlist
- && !processing_explicit_instantiation
- /* default_arg_ok_p tracks whether this is a parameter-clause for an
- actual function or a random abstract declarator. */
- && parser->default_arg_ok_p)
- if (!current_function_decl
- || (current_class_type && LAMBDA_TYPE_P (current_class_type)))
- parser->auto_is_implicit_function_template_parm_p = true;
+ if (lambda_p
+ || (!processing_specialization
+ && !processing_template_parmlist
+ && !processing_explicit_instantiation
+ /* default_arg_ok_p tracks whether this is a parameter-clause for an
+ actual function or a random abstract declarator. */
+ && parser->default_arg_ok_p
+ && !current_function_decl))
+ parser->auto_is_implicit_function_template_parm_p = true;
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
return error_mark_node;
tree parms = (cp_parser_parameter_declaration_clause
- (parser, CP_PARSER_FLAGS_TYPENAME_OPTIONAL));
+ (parser, CP_PARSER_FLAGS_TYPENAME_OPTIONAL,
+ /*lambda_p=*/false));
if (!parens.require_close (parser))
return error_mark_node;