------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-12 19:54 ------- Subject: Bug 7874
CVSROOT: /cvs/gcc Module name: gcc Changes by: [EMAIL PROTECTED] 2005-09-12 19:54:23 Modified files: gcc : ChangeLog c.opt gcc/cp : ChangeLog call.c class.c cp-tree.h decl.c friend.c name-lookup.c name-lookup.h pt.c semantics.c gcc/doc : invoke.texi gcc/testsuite : ChangeLog 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 scoping15.C gcc/testsuite/g++.old-deja/g++.mike: net43.C Added files: gcc/testsuite/g++.dg/lookup: friend7.C friend8.C Log message: ./ 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. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9941&r2=2.9942 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c.opt.diff?cvsroot=gcc&r1=1.50&r2=1.51 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4884&r2=1.4885 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.551&r2=1.552 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.731&r2=1.732 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1163&r2=1.1164 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1425&r2=1.1426 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/friend.c.diff?cvsroot=gcc&r1=1.109&r2=1.110 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.140&r2=1.141 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.h.diff?cvsroot=gcc&r1=1.44&r2=1.45 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1031&r2=1.1032 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.489&r2=1.490 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.676&r2=1.677 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6049&r2=1.6050 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/friend7.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/friend8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/defarg4.C.diff?cvsroot=gcc&r1=1.1&r2=1.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C.diff?cvsroot=gcc&r1=1.9&r2=1.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.jason/friend.C.diff?cvsroot=gcc&r1=1.4&r2=1.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.jason/scoping15.C.diff?cvsroot=gcc&r1=1.3&r2=1.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.mike/net43.C.diff?cvsroot=gcc&r1=1.4&r2=1.5 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7874