diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f6f6b69a622..0d571c0f687 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5671,7 +5671,9 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups) if ((type_build_ctor_call (type) || CLASS_TYPE_P (type)) && !(flags & LOOKUP_ALREADY_DIGESTED) && !(init && BRACE_ENCLOSED_INITIALIZER_P (init) - && CP_AGGREGATE_TYPE_P (type))) + && CP_AGGREGATE_TYPE_P (type) + && (CLASS_TYPE_P (type) + || type_has_extended_temps (type)))) { init_code = build_aggr_init_full_exprs (decl, init, flags); @@ -8527,6 +8529,23 @@ check_var_type (tree identifier, tree type) return type; } +/* Functions for adjusting the visibility of a tagged type and its nested + types when it gets a name for linkage purposes from a typedef. */ + +static void bt_reset_linkage (binding_entry, void *); +static void +reset_type_linkage (tree type) +{ + set_linkage_according_to_type (type, TYPE_MAIN_DECL (type)); + if (CLASS_TYPE_P (type)) + binding_table_foreach (CLASSTYPE_NESTED_UTDS (type), bt_reset_linkage, NULL); +} +static void +bt_reset_linkage (binding_entry b, void */*data*/) +{ + reset_type_linkage (b->type); +} + /* Given declspecs and a declarator (abstract or otherwise), determine the name and type of the object declared and construct a DECL node for it. @@ -10067,8 +10086,7 @@ grokdeclarator (const cp_declarator *declarator, = TYPE_IDENTIFIER (type); /* Adjust linkage now that we aren't anonymous anymore. */ - set_linkage_according_to_type (type, TYPE_MAIN_DECL (type)); - determine_visibility (TYPE_MAIN_DECL (type)); + reset_type_linkage (type); /* FIXME remangle member functions; member functions of a type with external linkage have external linkage. */ |