aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c151
1 files changed, 0 insertions, 151 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index f89b424..4a11b43 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1337,157 +1337,6 @@ get_type_value (tree name)
return NULL_TREE;
}
-
-/* This code could just as well go in `class.c', but is placed here for
- modularity. */
-
-/* For an expression of the form TYPE :: NAME (PARMLIST), build
- the appropriate function call. */
-
-tree
-build_member_call (tree type, tree name, tree parmlist)
-{
- tree t;
- tree method_name;
- tree fns;
- int dtor = 0;
- tree basetype_path, decl;
-
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR
- && TREE_CODE (type) == NAMESPACE_DECL)
- {
- /* 'name' already refers to the decls from the namespace, since we
- hit do_identifier for template_ids. */
- method_name = TREE_OPERAND (name, 0);
- /* FIXME: Since we don't do independent names right yet, the
- name might also be a LOOKUP_EXPR. Once we resolve this to a
- real decl earlier, this can go. This may happen during
- tsubst'ing. */
- if (TREE_CODE (method_name) == LOOKUP_EXPR)
- {
- method_name = lookup_namespace_name
- (type, TREE_OPERAND (method_name, 0));
- TREE_OPERAND (name, 0) = method_name;
- }
- my_friendly_assert (is_overloaded_fn (method_name), 980519);
- return finish_call_expr (name, parmlist, /*disallow_virtual=*/true);
- }
-
- if (DECL_P (name))
- name = DECL_NAME (name);
-
- if (TREE_CODE (type) == NAMESPACE_DECL)
- return finish_call_expr (lookup_namespace_name (type, name),
- parmlist,
- /*disallow_virtual=*/true);
-
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
- {
- method_name = TREE_OPERAND (name, 0);
- if (TREE_CODE (method_name) == COMPONENT_REF)
- method_name = TREE_OPERAND (method_name, 1);
- if (is_overloaded_fn (method_name))
- method_name = DECL_NAME (OVL_CURRENT (method_name));
- TREE_OPERAND (name, 0) = method_name;
- }
- else
- method_name = name;
-
- if (TREE_CODE (method_name) == BIT_NOT_EXPR)
- {
- method_name = TREE_OPERAND (method_name, 0);
- dtor = 1;
- }
-
- /* This shouldn't be here, and build_member_call shouldn't appear in
- parse.y! (mrs) */
- if (type && TREE_CODE (type) == IDENTIFIER_NODE
- && get_aggr_from_typedef (type, 0) == 0)
- {
- tree ns = lookup_name (type, 0);
- if (ns && TREE_CODE (ns) == NAMESPACE_DECL)
- return finish_call_expr (lookup_namespace_name (ns, name),
- parmlist,
- /*disallow_virtual=*/true);
- }
-
- if (type == NULL_TREE || ! is_aggr_type (type, 1))
- return error_mark_node;
-
- /* An operator we did not like. */
- if (name == NULL_TREE)
- return error_mark_node;
-
- if (dtor)
- {
- error ("cannot call destructor `%T::~%T' without object", type,
- method_name);
- return error_mark_node;
- }
-
- decl = maybe_dummy_object (type, &basetype_path);
-
- fns = lookup_fnfields (basetype_path, method_name, 0);
- if (fns)
- {
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
- BASELINK_FUNCTIONS (fns) = build_nt (TEMPLATE_ID_EXPR,
- BASELINK_FUNCTIONS (fns),
- TREE_OPERAND (name, 1));
- return build_new_method_call (decl, fns, parmlist,
- /*conversion_path=*/NULL_TREE,
- LOOKUP_NORMAL|LOOKUP_NONVIRTUAL);
- }
-
- /* Convert 'this' to the specified type to disambiguate conversion
- to the function's context. */
- if (decl == current_class_ref
- /* ??? this is wrong, but if this conversion is invalid we need to
- defer it until we know whether we are calling a static or
- non-static member function. Be conservative for now. */
- && ACCESSIBLY_UNIQUELY_DERIVED_P (type, current_class_type))
- {
- basetype_path = NULL_TREE;
- decl = build_scoped_ref (decl, type, &basetype_path);
- if (decl == error_mark_node)
- return error_mark_node;
- }
-
- if (constructor_name_p (method_name, type))
- return build_functional_cast (type, parmlist);
- if (TREE_CODE (name) == IDENTIFIER_NODE
- && ((t = lookup_field (TYPE_BINFO (type), name, 1, false))))
- {
- if (t == error_mark_node)
- return error_mark_node;
- if (TREE_CODE (t) == FIELD_DECL)
- {
- if (is_dummy_object (decl))
- {
- error ("invalid use of non-static field `%D'", t);
- return error_mark_node;
- }
- decl = build (COMPONENT_REF, TREE_TYPE (t), decl, t);
- }
- else if (TREE_CODE (t) == VAR_DECL)
- decl = t;
- else
- {
- error ("invalid use of member `%D'", t);
- return error_mark_node;
- }
- if (TYPE_LANG_SPECIFIC (TREE_TYPE (decl)))
- return build_new_op (CALL_EXPR, LOOKUP_NORMAL, decl,
- parmlist, NULL_TREE);
- return build_function_call (decl, parmlist);
- }
- else
- {
- error ("no method `%T::%D'", type, name);
- return error_mark_node;
- }
-}
-
/* Build a reference to a member of an aggregate. This is not a
C++ `&', but really something which can have its address taken,
and then act as a pointer to member, for example TYPE :: FIELD