diff options
Diffstat (limited to 'contrib/gcc/cp/decl2.c')
-rw-r--r-- | contrib/gcc/cp/decl2.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c index 09fe5dd..abd86f7 100644 --- a/contrib/gcc/cp/decl2.c +++ b/contrib/gcc/cp/decl2.c @@ -64,7 +64,6 @@ typedef struct priority_info_s { static void mark_vtable_entries (tree); static void grok_function_init (tree, tree); static bool maybe_emit_vtables (tree); -static tree build_anon_union_vars (tree); static bool acceptable_java_type (tree); static tree start_objects (int, int); static void finish_objects (int, int, tree); @@ -1131,14 +1130,13 @@ defer_fn (tree fn) VARRAY_PUSH_TREE (deferred_fns, fn); } -/* Walks through the namespace- or function-scope anonymous union OBJECT, - building appropriate ALIAS_DECLs. Returns one of the fields for use in - the mangled name. */ +/* Walks through the namespace- or function-scope anonymous union + OBJECT, with the indicated TYPE, building appropriate ALIAS_DECLs. + Returns one of the fields for use in the mangled name. */ static tree -build_anon_union_vars (tree object) +build_anon_union_vars (tree type, tree object) { - tree type = TREE_TYPE (object); tree main_decl = NULL_TREE; tree field; @@ -1185,7 +1183,7 @@ build_anon_union_vars (tree object) decl = pushdecl (decl); } else if (ANON_AGGR_TYPE_P (TREE_TYPE (field))) - decl = build_anon_union_vars (ref); + decl = build_anon_union_vars (TREE_TYPE (field), ref); else decl = 0; @@ -1225,7 +1223,7 @@ finish_anon_union (tree anon_union_decl) return; } - main_decl = build_anon_union_vars (anon_union_decl); + main_decl = build_anon_union_vars (type, anon_union_decl); if (main_decl == NULL_TREE) { warning ("anonymous union with no members"); @@ -2961,7 +2959,7 @@ check_default_args (tree x) { cp_error_at ("default argument missing for parameter %P of `%+#D'", i, x); - break; + TREE_PURPOSE (arg) = error_mark_node; } } } @@ -2969,6 +2967,18 @@ check_default_args (tree x) void mark_used (tree decl) { + /* If DECL is a BASELINK for a single function, then treat it just + like the DECL for the function. Otherwise, if the BASELINK is + for an overloaded function, we don't know which function was + actually used until after overload resolution. */ + if (TREE_CODE (decl) == BASELINK) + { + decl = BASELINK_FUNCTIONS (decl); + if (really_overloaded_fn (decl)) + return; + decl = OVL_CURRENT (decl); + } + TREE_USED (decl) = 1; if (processing_template_decl || skip_evaluation) return; |