diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-24 22:26:21 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-24 22:26:21 +0000 |
commit | 023e1e099d0d3e270f710b76a62f74140465fe88 (patch) | |
tree | 7589e8ff186b9e1c0b747c0c94d6aeeef0c68401 /gcc | |
parent | d1640684c015ffed28ab469f33d8974b5f369ddf (diff) | |
download | gcc-023e1e099d0d3e270f710b76a62f74140465fe88.tar.gz |
PR c++/28274
* name-lookup.c (pushdecl_maybe_friend): Check default args later.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145042 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/defarg14.C | 6 |
4 files changed, 23 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b9f469d6921..2d4c9f3aa21 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2009-03-24 Jason Merrill <jason@redhat.com> + + PR c++/28274 + * name-lookup.c (pushdecl_maybe_friend): Check default args later. + 2009-03-23 Jakub Jelinek <jakub@redhat.com> PR c/39495 diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 6424569d728..5a92dc6ed89 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -813,9 +813,6 @@ pushdecl_maybe_friend (tree x, bool is_friend) } } - if (TREE_CODE (x) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (x)) - check_default_args (x); - check_template_shadow (x); /* If this is a function conjured up by the back end, massage it @@ -826,11 +823,10 @@ pushdecl_maybe_friend (tree x, bool is_friend) SET_DECL_LANGUAGE (x, lang_c); } + t = x; if (DECL_NON_THUNK_FUNCTION_P (x) && ! DECL_FUNCTION_MEMBER_P (x)) { t = push_overloaded_decl (x, PUSH_LOCAL, is_friend); - if (t != x) - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t); if (!namespace_bindings_p ()) /* We do not need to create a binding for this name; push_overloaded_decl will have already done so if @@ -842,9 +838,14 @@ pushdecl_maybe_friend (tree x, bool is_friend) t = push_overloaded_decl (x, PUSH_GLOBAL, is_friend); if (t == x) add_decl_to_level (x, NAMESPACE_LEVEL (CP_DECL_CONTEXT (t))); - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t); } + if (TREE_CODE (x) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (x)) + check_default_args (x); + + if (t != x || DECL_FUNCTION_TEMPLATE_P (t)) + POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t); + /* If declaring a type as a typedef, copy the type (unless we're at line 0), and install this TYPE_DECL as the new type's typedef name. See the extensive comment in ../c-decl.c (pushdecl). */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee3a159cdf8..fdb786b6495 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-03-24 Jason Merrill <jason@redhat.com> + + PR c++/28274 + * g++.dg/parse/defarg14.C: New test. + 2009-03-24 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/39528 diff --git a/gcc/testsuite/g++.dg/parse/defarg14.C b/gcc/testsuite/g++.dg/parse/defarg14.C new file mode 100644 index 00000000000..0930b45eea4 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/defarg14.C @@ -0,0 +1,6 @@ +// PR c++/28274 + +extern "C" { +void foo (int i, int j = 6); +void foo (int i = 4, int j); +} |