mdt@YAHI.STANFORD.EDU (Michael Tiemann) (03/17/89)
See if this helps: yahi% diff -c2 cplus-class.c~ cplus-class.c *** cplus-class.c~ Tue Mar 14 23:04:58 1989 --- cplus-class.c Thu Mar 16 20:56:28 1989 *************** *** 1032,1046 **** if (testp) { for (x = TREE_VALUE (testp), basep = x ? DECL_BASELINK (x) : 0; x;) { ! if (DECL_NAME (fn_fields) == DECL_NAME (x)) { char buf[OVERLOAD_MAX_LEN]; /* We complain about multiple destructors on sight, ! so we do not repeat the warning here. */ ! if (! DESTRUCTOR_NAME_P (DECL_NAME (fn_fields))) { ! print_fndecl_with_types (buf, t, fn_fields, 1); ! yylineerror (DECL_SOURCE_LINE (fn_fields), "ambiguous method `%s' in structure", buf); } --- 1032,1048 ---- if (testp) { + tree fndecl = TREE_CODE (fn_fields) == FRIEND_DECL ? TREE_TYPE (fn_fields) : fn_fields; for (x = TREE_VALUE (testp), basep = x ? DECL_BASELINK (x) : 0; x;) { ! if (DECL_NAME (fndecl) == DECL_NAME (x)) { char buf[OVERLOAD_MAX_LEN]; /* We complain about multiple destructors on sight, ! so we do not repeat the warning here. Friend-friend ! ambiguities are warned about outside this loop. */ ! if (! DESTRUCTOR_NAME_P (DECL_NAME (fndecl))) { ! print_fndecl_with_types (buf, t, fndecl, 1); ! yylineerror (DECL_SOURCE_LINE (fndecl), "ambiguous method `%s' in structure", buf); } *************** *** 1054,1062 **** for (x = TREE_TYPE (testp); x;) { ! if (DECL_NAME (TREE_TYPE (fn_fields)) == DECL_NAME (TREE_TYPE (x))) { char buf[OVERLOAD_MAX_LEN]; ! print_fndecl_with_types (buf, t, TREE_TYPE (fn_fields), 1); ! yylineerror (DECL_SOURCE_LINE (fn_fields), "friend `%s' is ambiguous in structure", buf); break; --- 1056,1064 ---- for (x = TREE_TYPE (testp); x;) { ! if (DECL_NAME (fndecl) == DECL_NAME (TREE_TYPE (x))) { char buf[OVERLOAD_MAX_LEN]; ! print_fndecl_with_types (buf, t, fndecl, 1); ! yylineerror (DECL_SOURCE_LINE (fndecl), "friend `%s' is ambiguous in structure", buf); break; *************** *** 2914,2918 **** else { ! function = field; } if (protect == 0 || visibility == visibility_public) --- 2916,2920 ---- else { ! function = TREE_CODE (field) == FRIEND_DECL ? TREE_TYPE (field) : field; } if (protect == 0 || visibility == visibility_public) *************** *** 3088,3092 **** { n_inner_fields_searched++; ! function = field; cp->harshness = (unsigned short *)alloca ((len+1) * sizeof (short)); --- 3090,3094 ---- { n_inner_fields_searched++; ! function = TREE_CODE (field) == FRIEND_DECL ? TREE_TYPE (field) : field; cp->harshness = (unsigned short *)alloca ((len+1) * sizeof (short)); *************** *** 3132,3136 **** /* Initialize these fields for error reporting. */ cp->u.field = field; ! cp->function = field; field = TREE_CHAIN (field); continue; --- 3134,3138 ---- /* Initialize these fields for error reporting. */ cp->u.field = field; ! cp->function = TREE_CODE (field) == FRIEND_DECL ? TREE_TYPE (field) : field; field = TREE_CHAIN (field); continue; *************** *** 3283,3287 **** found: ! function = field; if (visibility == visibility_private) --- 3285,3289 ---- found: ! function = TREE_CODE (field) == FRIEND_DECL ? TREE_TYPE (field) : field; if (visibility == visibility_private) yahi% Michael