./
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Sep 2005 19:54:23 +0000 (19:54 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Sep 2005 19:54:23 +0000 (19:54 +0000)
commitc1d4295ffc35ae47e9423844877c4c2e4ce7565e
tree672854ad16a126bb970ef26565b6d30c3cb8e167
parent7aab4c5b0e569f4db9444c6c42abfd16e7918dc0
./
PR g++/7874
* c.opt (ffriend-injection): New C++ option.
* doc/invoke.texi (Option Summary): Mention -ffriend-injection.
(C++ Dialect Options): Document -ffriend-injection.
cp/
PR g++/7874
* cp-tree.h (struct lang_decl_flags): Add hidden_friend_p
bitfield.  Make dummy bitfield one bit smaller.
(DECL_HIDDEN_FRIEND_P): Define.
(pushdecl_maybe_friend): Declare.
(pushdecl_top_level_maybe_friend): Declare.
* decl.c (duplicate_decls): Add newdecl_is_friend parameter.
Change prototype and all callers.  Add assertion that a
DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P.  Set
DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if
appropriate.
* name-lookup.c (supplement_binding): Don't ignore a
DECL_HIDDEN_FRIEND_P.
(pushdecl_maybe_friend): Break out contents of pushdecl.  Add
is_friend parameter.  Set DECL_ANTICIPATED and
DECL_HIDDEN_FRIEND_P for a friend function.
(pushdecl): Just call pushdecl_maybe_friend.
(pushdecl_with_scope): Add is_friend parameter.  Change prototype
and all callers.
(pushdecl_namespace_level): Likewise.
(push_overloaded_decl): Likewise.  Check DECL_HIDDEN_FRIEND_P as
well as DECL_ANTICIPATED when checking for a builtin.
(do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as
DECL_ANTICIPATED when checking for a builtin.
(do_nonmember_using_decl): Likewise.
(pushdecl_top_level_1): Add is_friend parameter.  Change all
callers.
(pushdecl_top_level_maybe_friend): New function.
(remove_hidden_names): New function.
(struct arg_lookup): Add args field.
(friend_of_associated_class_p): New static function.
(arg_assoc_namespace): Ignore hidden functions which are not
friends of an associated class of some argument.
(lookup_arg_dependent): Remove hidden functions from list passed
in.  Initialize k.args.
* name-lookup.h (remove_hidden_names): Declare.
* friend.c (do_friend): Call pushdecl_maybe_friend instead of
pushdecl.
* call.c (add_function_candidate): Change DECL_ANTICIPATED test to
an assertion, with a check for DECL_HIDDEN_FRIEND_P.
(build_new_function_call): Add koenig_p parameter.  Change
prototype and callers.
* pt.c (register_specialization): Add is_friend parameter.  Change
all callers.
(push_template_decl_real): Change is_friend parameter to bool.
Change prototype and all callers.
(tsubst_friend_class): Call pushdecl_top_level_maybe_friend
instead of pushdecl_top_level.
testsuite/
PR g++/7874
* g++.dg/lookup/friend7.C: New test.
* g++.dg/lookup/friend8.C: New test.
* g++.dg/parse/defarg4.C: Add a parameter to the friend function,
so that it will be found via argument dependent lookup.
* g++.old-deja/g++.brendan/crash56.C: Don't expect errors for
friend functions which will no longer be found.
* g++.old-deja/g++.jason/friend.C: Add a parameter to the friend
function g, so that it will be found via argument dependent
lookup.
* g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection.
* g++.old-deja/g++.mike/net43.C: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104188 138bc75d-0d04-0410-961f-82ee72b054a4
21 files changed:
gcc/ChangeLog
gcc/c.opt
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/friend.c
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/friend7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/friend8.C [new file with mode: 0644]
gcc/testsuite/g++.dg/parse/defarg4.C
gcc/testsuite/g++.old-deja/g++.brendan/crash56.C
gcc/testsuite/g++.old-deja/g++.jason/friend.C
gcc/testsuite/g++.old-deja/g++.jason/scoping15.C
gcc/testsuite/g++.old-deja/g++.mike/net43.C