aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-04-02 15:36:57 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-04-02 15:36:57 +0000
commit8f0327178b2158f8c6ee5996b2bd12c7dde8dbe8 (patch)
tree02cb3c75e09886d14b7139c3afd1bb1d30e0d868 /gcc/cp/call.c
parentae7f727035108e8c78bfa4d2d506041169d0db1b (diff)
downloadgcc-8f0327178b2158f8c6ee5996b2bd12c7dde8dbe8.zip
gcc-8f0327178b2158f8c6ee5996b2bd12c7dde8dbe8.tar.gz
gcc-8f0327178b2158f8c6ee5996b2bd12c7dde8dbe8.tar.bz2
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com> * tinfo.h (__class_type_info): Fix illegal declaration. * cp-tree.def (TEMPLATE_ID_EXPR): Update comment. * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro. (IDENTIFIER_CLASS_VALUE): Improve documentation. (is_properly_derived_from): Declare. (invalidate_class_lookup_cache): Likewise. (maybe_maybe_note_name_used_in_class): Likewise. (note_name_declared_in_class): Likewise. (push_using_decl): Remove duplicate declaration. (id_in_current_class): Remove declaration. (push_class_binding): Change prototype. (clear_identitifer_class_values): Declare. * call.c (is_properly_derived_from): Make it global. (build_new_function_call): Be careful about updating candidates. (build_new_method_call): Handle COMPONENT_REFs. Don't crash when asked to make illegal calls. * class.c: Include splay-tree.h. (class_stack_node): Add names_used slot. (check_member_decl_is_same_in_complete_scope): Remove. (add_method): Fix comment. Push the declaration into class scope. (finish_struct_1): When popping the class, pop the bindings too. Remove check for data member/function member conflict. (finish_struct): Remove calls to check_member_decl_is_same_in_complete_scope. Change calls to popclass. (pushclass): Clear names_used in the class stack entry. Use invalidate_class_lookup_cache to remove cached entries, rather than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE before entering a new class. Remove dead code. Don't mess with current_function_decl when pushing declarations. (invalidate_class_lookup_cache): New function, split out from ... (popclass): Here. Clean up names_used on our way out. (instantiate_type): Adjust. (build_self_reference): Don't push the declaration here. (maybe_note_name_used_in_class): New function. (note_name_declared_in_class): Likewise. * decl.c (add_binding): Change prototype. (find_class_binding_level): New function. (innermost_nonclass_level): Likewise. (current_binding_level): Update documentation. (inner_binding_level): Remove. Replace with current_binding_level throughout. (push_binding_level): Remove special handling of class_binding_level. (pop_binding_level): Likewise. Use find_class_binding_level. (suspend_binding_level): Likewise. (global_bindings_p): Use innermost_nonclass_level. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (pseudo_global_level_p): Likewise. (push_binding): Clear INHERITED_VALUE_BINDING_P. (add_binding): Check for illegal multiple declarations. Return a value indicating whether or not the new binding was legal. (push_local_binding): Skip over class binding levels. Check return value from add_binding. (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call note_name_declared_in_class. (pushlevel_class): Remove "fake out the rest of the compiler" code. (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs. (clear_identifier_class_values): New function. (pop_from_top_level): Use it. (pop_everything): Tweak. (maybe_process_template_type_declaration): Don't push the declaration for the template here. (pushtag): Don't push tag declarations into class scope here. (pushdecl): Apply DeMorgan's law for readability. (pushdecl_class_level): Remove special-case code for TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions. (push_class_level_bindng): Deal with inherited bindings. (lookup_name_real): Remove special-case code for TYPE_BEING_DEFINED, and some implicit typename magic. (grokdeclarator): Handle COMPONENT_REF for a template function. (build_enumerator): Don't call pushdecl_class_level here. (id_in_current_class): Remove. * decl2.c (grokfield): Don't call pushdecl_class_level or check_template_shadow. * errfn.c (cp_file_of): Don't declare. (cp_line_of): Likewise. * error.c (dump_decl): Handle an OVERLOAD. (cp_file_of): Likewise. (cp_line_of): Likewise. * init.c (build_member_call): Handle a COMPONENT_REF. * lex.c (do_identifier): Call maybe_note_name_used_in_class, not pushdecl_class_level. * method.c (hack_identifier): Build COMPONENT_REFs for references to member templates as well as member functions. Remove dead code. * parse.y (left_curly): Remove. (nonnested_type): Call maybe_note_name_used_in_class, not pushdecl_class_level. * parse.c: Regenerated. (nested_name_specifier_1): Likewise. * pt.c (check_explicit_specialization): Adjust, for robustness. (check_template_shadow): Handle OVERLOADs. (build_template_decl): Set DECL_CONSTRUCTOR_P on the TEMPLATE_DECL, if appropriate. * search.c (envelope_add_decl): Remove. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (dfs_push_decls): New function. (dfs_push_type_decls): Likewise. (setup_class_bindings): Likewise. (template_self_reference_p): Likewise. (lookup_field_r): Use it. (looup_member): Remove old comment. Deal with ambiguity. (push_class_decls): Use dfs_push_decls and dfs_push_type_decls, and remove envelope processing. * semantics.c (begin_class_definition): Let pushclass push declarations for base classes. (finish_member_declaration): Push declarations into class scope. * typeck.c (build_component_ref): Just put an OVERLOAD into the COMPONENT_REF, not a TREE_LIST of an OVERLOAD. (build_x_function_call): Deal with OVERLOAD. Handle template-ids. * Makefile.in (class.o): Depend on splay-tree.h. From-SVN: r26133
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 9bc349e..f3ef258 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -87,7 +87,6 @@ static tree strip_top_quals PROTO((tree));
static tree non_reference PROTO((tree));
static tree build_conv PROTO((enum tree_code, tree, tree));
static int is_subseq PROTO((tree, tree));
-static int is_properly_derived_from PROTO((tree, tree));
static int maybe_handle_ref_bind PROTO((tree*, tree*));
static void maybe_handle_implicit_object PROTO((tree*));
static struct z_candidate * add_candidate PROTO((struct z_candidate *,
@@ -2312,6 +2311,8 @@ build_new_function_call (fn, args)
for (t1 = fn; t1; t1 = OVL_CHAIN (t1))
{
tree t = OVL_FUNCTION (t1);
+ struct z_candidate *old_candidates = candidates;
+
if (TREE_CODE (t) == TEMPLATE_DECL)
{
templates = scratch_tree_cons (NULL_TREE, t, templates);
@@ -2322,6 +2323,9 @@ build_new_function_call (fn, args)
else if (! template_only)
candidates = add_function_candidate
(candidates, t, args, LOOKUP_NORMAL);
+
+ if (candidates != old_candidates)
+ candidates->basetype_path = DECL_REAL_CONTEXT (t);
}
if (! any_viable (candidates))
@@ -3524,8 +3528,16 @@ build_new_method_call (instance, name, args, basetype_path, flags)
{
explicit_targs = TREE_OPERAND (name, 1);
name = TREE_OPERAND (name, 0);
- if (TREE_CODE (name) == TEMPLATE_DECL)
+ if (TREE_CODE_CLASS (TREE_CODE (name)) == 'd')
name = DECL_NAME (name);
+ else
+ {
+ if (TREE_CODE (name) == COMPONENT_REF)
+ name = TREE_OPERAND (name, 1);
+ if (TREE_CODE (name) == OVERLOAD)
+ name = DECL_NAME (OVL_CURRENT (name));
+ }
+
template_only = 1;
}
@@ -3675,7 +3687,10 @@ build_new_method_call (instance, name, args, basetype_path, flags)
cp_error ("abstract virtual `%#D' called from constructor", cand->fn);
if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
&& is_dummy_object (instance_ptr))
- cp_error ("cannot call member function `%D' without object", cand->fn);
+ {
+ cp_error ("cannot call member function `%D' without object", cand->fn);
+ return error_mark_node;
+ }
if (DECL_VINDEX (cand->fn) && ! (flags & LOOKUP_NONVIRTUAL)
&& ((instance == current_class_ref && (dtor_label || ctor_label))
@@ -3738,7 +3753,7 @@ is_subseq (ics1, ics2)
/* Returns non-zero iff DERIVED is derived from BASE. The inputs may
be any _TYPE nodes. */
-static int
+int
is_properly_derived_from (derived, base)
tree derived;
tree base;