diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1997-11-17 19:36:41 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-11-17 14:36:41 -0500 |
commit | 37130ac37263ec5b79b6265623d933c83a85acd3 (patch) | |
tree | 6585cff723446f24dbc87b66a4ad2f9a2affc059 | |
parent | cb0112a7f392760a3094d53eba443c43006aafec (diff) | |
download | gcc-37130ac37263ec5b79b6265623d933c83a85acd3.zip gcc-37130ac37263ec5b79b6265623d933c83a85acd3.tar.gz gcc-37130ac37263ec5b79b6265623d933c83a85acd3.tar.bz2 |
search.c (dfs_record_inheritance): Ignore template type parms.
* search.c (dfs_record_inheritance): Ignore template type parms.
Fixes 13688.
* friend.c (do_friend): Warn about non-template friends in templates.
* call.c (build_op_delete_call): Fix handling of inherited delete.
From-SVN: r16551
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/call.c | 14 | ||||
-rw-r--r-- | gcc/cp/friend.c | 24 | ||||
-rw-r--r-- | gcc/cp/search.c | 4 |
4 files changed, 40 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0349d52..a480eba 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +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. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ed40a07..d4ecb62 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5125,15 +5125,17 @@ build_op_delete_call (code, addr, size, flags) 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; @@ -5182,7 +5184,7 @@ build_op_delete_call (code, addr, size, flags) { 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)); } diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index fbfffe7..28c0bb4 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -381,10 +381,26 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag) 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); diff --git a/gcc/cp/search.c b/gcc/cp/search.c index d75fe62..03e00fa 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -3134,6 +3134,10 @@ dfs_record_inheritance (binfo) 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) |