diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2004-07-12 16:06:40 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-07-12 16:06:40 +0000 |
commit | cad7e87b1191e2b96f22ca5b12cddc528e364340 (patch) | |
tree | bb13256ed44abc12331324fbb0e1e57406cd13df /gcc/cp/search.c | |
parent | 255cd731f40dd7b5855e0bc12a9cdd6383e65321 (diff) | |
download | gcc-cad7e87b1191e2b96f22ca5b12cddc528e364340.tar.gz |
call.c (build_user_type_conversion_1, [...]): Pass type directly to lookup_fnfields & build_special_member_call.
* call.c (build_user_type_conversion_1, build_new_op,
check_constructor_callable, build_temp,
perform_direct_initialization_of_possible): Pass type directly to
lookup_fnfields & build_special_member_call.
(build_special_member_call): Accept a type, and complete it.
* class.c (finish_stuct_bits): Copy the BINFOs here.
* cvt.c (ocp_convert): Pass type directly to
build_special_member_call.
* decl.c (build_ptrmemfunc_type): Call xref_bastypes here.
(xref_basetypes): Allocate the binfo here. Adjust.
* init.c (build_init, build_new_1): Pass type directly to
build_special_member_call.
* lex.c (cxx_make_type): Do not allocate binfo here.
* name-lookup.c (arg_assoc_class): Incomplete types have no binfo.
* parser.c (cp_parser_class_head): Always call xref_basetypes.
* pt.c (instantiate_class_template): Likewise. Inhibit access
checking for template friends.
* ptree.c (cxx_print_type): Adjust record printing.
* search.c (lookup_base): When taking a type, complete it before
looking for a binfo.
(lookup_member): Delay completing a type.
(push_class_decls): Don't walk an incomplete type.
(lookup_conversions): Likewise.
* semantics.c (finish_stmt_expr_expr): Pass type directly to
build_special_member_call.
* tree.c (copy_base_binfos): Adjust.
(make_binfo): Likewise.
* typeck.c (build_modify_expr): Pass type directly to
build_special_member_call.
* typeck2.c (process_init_constructor): Check a binfo exists.
(build_m_component_ref): Allow accessing an incomplete type.
(build_functional_cast): Pass type directly to
build_special_member_call.
From-SVN: r84562
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r-- | gcc/cp/search.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c index da9a7cfdc7f..83925b8d2fd 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -270,8 +270,8 @@ accessible_base_p (tree t, tree base) tree lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) { - tree binfo = NULL; /* The binfo we've found so far. */ - tree t_binfo = NULL; + tree binfo = NULL_TREE; /* The binfo we've found so far. */ + tree t_binfo = NULL_TREE; base_kind bk; if (t == error_mark_node || base == error_mark_node) @@ -287,14 +287,18 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) t_binfo = t; t = BINFO_TYPE (t); } - else - t_binfo = TYPE_BINFO (t); - - /* Ensure that the types are instantiated. */ - t = complete_type (TYPE_MAIN_VARIANT (t)); - base = complete_type (TYPE_MAIN_VARIANT (base)); + else + { + t = complete_type (TYPE_MAIN_VARIANT (t)); + t_binfo = TYPE_BINFO (t); + } - bk = lookup_base_r (t_binfo, base, access, 0, &binfo); + base = complete_type (TYPE_MAIN_VARIANT (base)); + + if (t_binfo) + bk = lookup_base_r (t_binfo, base, access, 0, &binfo); + else + bk = bk_not_base; /* Check that the base is unambiguous and accessible. */ if (access != ba_any) @@ -1256,8 +1260,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type) { my_friendly_assert (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)), 20030624); type = xbasetype; - basetype_path = TYPE_BINFO (type); - my_friendly_assert (!BINFO_INHERITANCE_CHAIN (basetype_path), 980827); + xbasetype = NULL_TREE; } if (type == current_class_type && TYPE_BEING_DEFINED (type) @@ -1271,7 +1274,12 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type) return field; } - complete_type (type); + type = complete_type (type); + if (!basetype_path) + basetype_path = TYPE_BINFO (type); + + if (!basetype_path) + return NULL_TREE; #ifdef GATHER_STATISTICS n_calls_lookup_field++; @@ -2239,6 +2247,11 @@ push_class_decls (tree type) { search_stack = push_search_level (search_stack, &search_obstack); + if (!TYPE_BINFO (type)) + /* This occurs when parsing an invalid declarator id where the + scope is incomplete. */ + return; + /* Enter type declarations and mark. */ dfs_walk (TYPE_BINFO (type), dfs_push_type_decls, unmarked_pushdecls_p, 0); @@ -2351,7 +2364,8 @@ lookup_conversions (tree type) tree conversions = NULL_TREE; complete_type (type); - bfs_walk (TYPE_BINFO (type), add_conversions, 0, &conversions); + if (TYPE_BINFO (type)) + bfs_walk (TYPE_BINFO (type), add_conversions, 0, &conversions); for (t = conversions; t; t = TREE_CHAIN (t)) IDENTIFIER_MARKED (DECL_NAME (OVL_CURRENT (TREE_VALUE (t)))) = 0; |