diff options
Diffstat (limited to 'gcc/cp/parser.c')
| -rw-r--r-- | gcc/cp/parser.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 41fe858..cb357cf 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -965,6 +965,24 @@ make_parameter_declarator (cp_decl_specifier_seq *decl_specifiers, return parameter; } +/* Returns true iff DECLARATOR is a declaration for a function. */ + +static bool +function_declarator_p (const cp_declarator *declarator) +{ + while (declarator) + { + if (declarator->kind == cdk_function + && declarator->declarator->kind == cdk_id) + return true; + if (declarator->kind == cdk_id + || declarator->kind == cdk_error) + return false; + declarator = declarator->declarator; + } + return false; +} + /* The parser. */ /* Overview @@ -11157,8 +11175,7 @@ cp_parser_init_declarator (cp_parser* parser, is_non_constant_init = true; if (is_initialized) { - if (declarator->kind == cdk_function - && declarator->declarator->kind == cdk_id + if (function_declarator_p (declarator) && initialization_kind == CPP_EQ) initializer = cp_parser_pure_specifier (parser); else @@ -13825,8 +13842,7 @@ cp_parser_member_declaration (cp_parser* parser) for a pure-specifier; otherwise, we look for a constant-initializer. When we call `grokfield', it will perform more stringent semantics checks. */ - if (declarator->kind == cdk_function - && declarator->declarator->kind == cdk_id) + if (function_declarator_p (declarator)) initializer = cp_parser_pure_specifier (parser); else /* Parse the initializer. */ |
