+Mon Nov 17 02:01:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * friend.c (do_friend): Warn about non-template friends in templates.
+
+ * call.c (build_op_delete_call): Fix handling of inherited delete.
+
+ * search.c (dfs_record_inheritance): Ignore template type parms.
+
Sat Nov 15 00:30:51 1997 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_new_op): Fix copy error.
fnname = ansi_opname[code];
if (IS_AGGR_TYPE (type) && ! (flags & LOOKUP_GLOBAL))
- /* Here we make assumptions about how instantiate_type works. This comes
- out as a simple TREE_LIST, so it looks like overloaded globals to
- instantiate_type; this works out fine. If something changes we
- might have to build this up like build_offset_ref does. */
fns = lookup_fnfields (TYPE_BINFO (type), fnname, 0);
else
fns = NULL_TREE;
- if (fns == NULL_TREE)
+ if (fns)
+ {
+ /* Build this up like build_offset_ref does. */
+ fns = build_tree_list (error_mark_node, fns);
+ TREE_TYPE (fns) = build_offset_type (type, unknown_type_node);
+ }
+ else
fns = lookup_name_nonclass (fnname);
/* We can recognize a placement delete because of LOOKUP_SPECULATIVELY;
{
if (TREE_PURPOSE (fns))
/* TREE_PURPOSE is only set for lists of member functions. */
- enforce_access (TREE_PURPOSE (fns), fn);
+ enforce_access (TREE_PURPOSE (TREE_VALUE (fns)), fn);
return build_function_call (fn, expr_tree_cons (NULL_TREE, addr, args));
}
DECL_CLASS_CONTEXT (decl) = current_class_type;
if (! DECL_USE_TEMPLATE (decl))
- /* We can call pushdecl here, because the TREE_CHAIN of this
- FUNCTION_DECL is not needed for other purposes. Don't do this
- for a template instantiation. */
- decl = pushdecl (decl);
+ {
+ /* We can call pushdecl here, because the TREE_CHAIN of this
+ FUNCTION_DECL is not needed for other purposes. Don't do this
+ for a template instantiation. */
+ decl = pushdecl (decl);
+
+ if (! funcdef_flag && ! flag_guiding_decls
+ && current_template_parms && uses_template_parms (decl))
+ {
+ static int explained;
+ cp_warning ("friend declaration `%#D'", decl);
+ warning (" will not be treated as a template instantiation");
+ if (! explained)
+ {
+ warning (" unless you compile with -fguiding-decls");
+ warning (" or add <> after the function name");
+ explained = 1;
+ }
+ }
+ }
make_decl_rtl (decl, NULL_PTR, 1);
add_friend (current_class_type, decl);
tree baseclass = BINFO_TYPE (base_binfo);
mi_boolean *base_row = BINFO_DERIVES_FROM_STAR (base_binfo);
+ if (TREE_CODE (baseclass) == TEMPLATE_TYPE_PARM)
+ continue;
+ my_friendly_assert (CLASSTYPE_CID (baseclass) != 0, 2365);
+
/* Don't search if there's nothing there! MI_SIZE can be
zero as a result of parse errors. */
if (TYPE_BINFO_BASETYPES (baseclass) && mi_size > 0)