diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-07-03 16:10:52 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-07-03 16:10:52 +0000 |
commit | 8db1028ebab32f0d725be8dc886a6aa335d81575 (patch) | |
tree | cecd1124ba5e8aecaff532002a217533915f83ea /gcc/cp/decl2.c | |
parent | 58eabcb1e9b9e16550757ba6b744148d20a7457f (diff) | |
download | gcc-8db1028ebab32f0d725be8dc886a6aa335d81575.zip gcc-8db1028ebab32f0d725be8dc886a6aa335d81575.tar.gz gcc-8db1028ebab32f0d725be8dc886a6aa335d81575.tar.bz2 |
re PR c++/9162 ([New parser] Problem with default argument in a friend function)
cp:
PR c++/9162
* decl.c (grokdeclarator): Return friend decls, not
void_type_node.
* decl2.c (grokfield): Alter friend decl check.
* parser.c (struct cp_parser): Document default_arg chain on
unparsed_functions_queue.
(cp_parser_save_default_args): New.
(cp_parser_init_declarator, cp_parser_function_definition,
cp_parser_member_declaration): Call it.
(cp_parser_class_specifier): Remove unused variable. Alter
processing of unparsed_functions_queue.
testsuite:
PR c++/9162
* g++.dg/parse/defarg4.C: New.
From-SVN: r68886
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index faa36f5..ab29aee 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -889,8 +889,14 @@ grokfield (tree declarator, tree declspecs, tree init, tree asmspec_tree, } /* Pass friendly classes back. */ - if (TREE_CODE (value) == VOID_TYPE) - return void_type_node; + if (value == void_type_node) + return value; + + /* Pass friend decls back. */ + if ((TREE_CODE (value) == FUNCTION_DECL + || TREE_CODE (value) == TEMPLATE_DECL) + && DECL_CONTEXT (value) != current_class_type) + return value; if (DECL_NAME (value) != NULL_TREE && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_' |