diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-12-04 14:51:32 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-12-04 14:51:32 -0800 |
commit | 945ae3ab27757d3261d99446f96105c5ebe70247 (patch) | |
tree | a8a120ef5393206d3bc9d2b5882bac1562824836 /gcc/cp | |
parent | f012991e2db06cc95f7aac8ecb74a1ac5f51f3d2 (diff) | |
parent | 918a5b84a2c51dc9d011d39461cc276e6558069d (diff) | |
download | gcc-945ae3ab27757d3261d99446f96105c5ebe70247.zip gcc-945ae3ab27757d3261d99446f96105c5ebe70247.tar.gz gcc-945ae3ab27757d3261d99446f96105c5ebe70247.tar.bz2 |
Merge from trunk revision 918a5b84a2c51dc9d011d39461cc276e6558069d
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 67 | ||||
-rw-r--r-- | gcc/cp/cp-gimplify.c | 2 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 134 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 | ||||
-rw-r--r-- | gcc/cp/parser.c | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 35 | ||||
-rw-r--r-- | gcc/cp/tree.c | 55 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 19 |
8 files changed, 248 insertions, 72 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6728ea1..1bf50cd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,70 @@ +2020-12-03 Jason Merrill <jason@redhat.com> + + * cp-tree.h (releasing_vec::operator[]): Change parameter type to + ptrdiff_t. + +2020-12-03 Nathan Sidwell <nathan@acm.org> + + * cp-tree.h (OVL_EXPORT): New. + (class ovl_iterator): Add get_using, exporting_p. + * tree.c (ovl_insert): Extend using_or_hidden meaning to include + an exported using. + +2020-12-03 Nathan Sidwell <nathan@acm.org> + + * cp-tree.h (DECL_UNINSTANTIATED_TEMPLATE_FRIEND): New. + * pt.c (push_template_decl): Set it. + (tsubst_friend_function): Clear it. + +2020-12-03 Nathan Sidwell <nathan@acm.org> + + * cp-tree.h (make_unbound_class_template_raw): Declare. + (canonical_type_parameter): Declare. + * decl.c (make_unbound_class_template_raw): Break out of ... + (make_unboud_class_template): ... here. Call it. + * pt.c (canonical_type_parameter): Externalize. Refactor & set + structural_equality for type parms. + +2020-12-03 Nathan Sidwell <nathan@acm.org> + + PR c++/98107 + * tree.c (build_cplus_array_type): Mark dependency of new variant. + (cp_build_qualified_type_real, strip_typedefs): Assert + TYPE_DEPENDENT_P_VALID, or not a dependent type. + +2020-12-03 Jakub Jelinek <jakub@redhat.com> + + PR libstdc++/93121 + * cp-tree.h (cp_build_bit_cast): Declare. + * cp-tree.def (BIT_CAST_EXPR): New tree code. + * cp-objcp-common.c (names_builtin_p): Handle RID_BUILTIN_BIT_CAST. + (cp_common_init_ts): Handle BIT_CAST_EXPR. + * cxx-pretty-print.c (cxx_pretty_printer::postfix_expression): + Likewise. + * parser.c (cp_parser_postfix_expression): Handle + RID_BUILTIN_BIT_CAST. + * semantics.c (cp_build_bit_cast): New function. + * tree.c (cp_tree_equal): Handle BIT_CAST_EXPR. + (cp_walk_subtrees): Likewise. + * pt.c (tsubst_copy): Likewise. + * constexpr.c (check_bit_cast_type, cxx_eval_bit_cast): New functions. + (cxx_eval_constant_expression): Handle BIT_CAST_EXPR. + (potential_constant_expression_1): Likewise. + * cp-gimplify.c (cp_genericize_r): Likewise. + +2020-12-03 Jason Merrill <jason@redhat.com> + + * parser.c (cp_parser_primary_expression): Distinguish + parms from vars in error. + (cp_parser_late_parsing_default_args): Pushdecl parms + as we go. + +2020-12-03 Jason Merrill <jason@redhat.com> + + * name-lookup.c (begin_scope): Set immediate_fn_ctx_p. + * parser.c (cp_parser_late_parsing_default_args): Push + sk_function_parms scope. + 2020-12-03 Peter Bergner <bergner@linux.ibm.com> PR c++/97947 diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index bafcaf5..8bbcf01 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -3005,7 +3005,7 @@ fold_builtin_source_location (location_t loc) const char *name = ""; if (current_function_decl) - name = cxx_printable_name (current_function_decl, 0); + name = cxx_printable_name (current_function_decl, 2); val = build_string_literal (strlen (name) + 1, name); } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 69f8ed5..00901fe 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -488,10 +488,9 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE) CONSTRUCTOR_C99_COMPOUND_LITERAL (in CONSTRUCTOR) - DECL_MODULE_EXPORT_P (in _DECL) OVL_NESTED_P (in OVERLOAD) LAMBDA_EXPR_INSTANTIATED (in LAMBDA_EXPR) - Reserved for DECL_MODULE_EXPORT (in DECL_) + DECL_MODULE_EXPORT_P (in _DECL) 4: IDENTIFIER_MARKED (IDENTIFIER_NODEs) TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, CALL_EXPR, or FIELD_DECL). @@ -503,6 +502,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE) CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) CONSTRUCTOR_PLACEHOLDER_BOUNDARY (in CONSTRUCTOR) + OVL_EXPORT_P (in OVERLOAD) 6: TYPE_MARKED_P (in _TYPE) DECL_NONTRIVIALLY_INITIALIZED_P (in VAR_DECL) RANGE_FOR_IVDEP (in RANGE_FOR_STMT) @@ -545,6 +545,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; DECL_ANON_UNION_VAR_P (in a VAR_DECL) DECL_SELF_REFERENCE_P (in a TYPE_DECL) DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL) + DECL_UNINSTANIATED_TEMPLATE_FRIEND_P (in TEMPLATE_DECL) 5: DECL_INTERFACE_KNOWN. 6: DECL_THIS_STATIC (in VAR_DECL, FUNCTION_DECL or PARM_DECL) DECL_FIELD_IS_BASE (in FIELD_DECL) @@ -779,6 +780,8 @@ typedef struct ptrmem_cst * ptrmem_cst_t; #define OVL_NESTED_P(NODE) TREE_LANG_FLAG_3 (OVERLOAD_CHECK (NODE)) /* If set, this overload was constructed during lookup. */ #define OVL_LOOKUP_P(NODE) TREE_LANG_FLAG_4 (OVERLOAD_CHECK (NODE)) +/* If set, this OVL_USING_P overload is exported. */ +#define OVL_EXPORT_P(NODE) TREE_LANG_FLAG_5 (OVERLOAD_CHECK (NODE)) /* The first decl of an overload. */ #define OVL_FIRST(NODE) ovl_first (NODE) @@ -838,6 +841,11 @@ class ovl_iterator { return fn; } + tree get_using () const + { + gcc_checking_assert (using_p ()); + return ovl; + } public: /* Whether this overload was introduced by a using decl. */ @@ -846,6 +854,12 @@ class ovl_iterator { return (TREE_CODE (ovl) == USING_DECL || (TREE_CODE (ovl) == OVERLOAD && OVL_USING_P (ovl))); } + /* Whether this using is being exported. */ + bool exporting_p () const + { + return OVL_EXPORT_P (get_using ()); + } + bool hidden_p () const { return TREE_CODE (ovl) == OVERLOAD && OVL_HIDDEN_P (ovl); @@ -961,8 +975,10 @@ public: operator vec_t *() const { return v; } vec_t ** operator& () { return &v; } - /* Breaks pointer/value consistency for convenience. */ - tree& operator[] (unsigned i) const { return (*v)[i]; } + /* Breaks pointer/value consistency for convenience. This takes ptrdiff_t + rather than unsigned to avoid ambiguity with the built-in operator[] + (bootstrap/91828). */ + tree& operator[] (ptrdiff_t i) const { return (*v)[i]; } ~releasing_vec() { release_tree_vector (v); } private: @@ -3161,6 +3177,13 @@ struct GTY(()) lang_decl { (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) \ ->u.base.friend_or_tls) +/* True of a TEMPLATE_DECL that is a template class friend. Such + decls are not pushed until instantiated (as they may depend on + parameters of the befriending class). DECL_CHAIN is the + befriending class. */ +#define DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P(NODE) \ + (DECL_LANG_FLAG_4 (TEMPLATE_DECL_CHECK (NODE))) + /* Nonzero if the thread-local variable was declared with __thread as opposed to thread_local. */ #define DECL_GNU_TLS_P(NODE) \ @@ -5399,10 +5422,6 @@ extern int function_depth; in structrual_comptypes. */ extern int comparing_specializations; -/* Nonzero if we are inside eq_specializations, which affects - resolving of typenames in structural_comptypes. */ -extern int comparing_typenames; - /* In parser.c. */ /* Nonzero if we are parsing an unevaluated operand: an operand to @@ -6863,6 +6882,103 @@ extern bool ctor_omit_inherited_parms (tree); extern tree locate_ctor (tree); extern tree implicitly_declare_fn (special_function_kind, tree, bool, tree, tree); +/* In module.cc */ +class module_state; /* Forward declare. */ +inline bool modules_p () { return flag_modules != 0; } + +/* The kind of module or part thereof that we're in. */ +enum module_kind_bits +{ + MK_MODULE = 1 << 0, /* This TU is a module. */ + MK_GLOBAL = 1 << 1, /* Entities are in the global module. */ + MK_INTERFACE = 1 << 2, /* This TU is an interface. */ + MK_PARTITION = 1 << 3, /* This TU is a partition. */ + MK_EXPORTING = 1 << 4, /* We are in an export region. */ +}; + +/* We do lots of bit-manipulation, so an unsigned is easier. */ +extern unsigned module_kind; + +/* MK_MODULE & MK_GLOBAL have the following combined meanings: + MODULE GLOBAL + 0 0 not a module + 0 1 GMF of named module (we've not yet seen module-decl) + 1 0 purview of named module + 1 1 header unit. */ + +inline bool module_purview_p () +{ return module_kind & MK_MODULE; } +inline bool global_purview_p () +{ return module_kind & MK_GLOBAL; } + +inline bool not_module_p () +{ return (module_kind & (MK_MODULE | MK_GLOBAL)) == 0; } +inline bool named_module_p () +{ /* This is a named module if exactly one of MODULE and GLOBAL is + set. */ + /* The divides are constant shifts! */ + return ((module_kind / MK_MODULE) ^ (module_kind / MK_GLOBAL)) & 1; +} +inline bool header_module_p () +{ return (module_kind & (MK_MODULE | MK_GLOBAL)) == (MK_MODULE | MK_GLOBAL); } +inline bool named_module_purview_p () +{ return (module_kind & (MK_MODULE | MK_GLOBAL)) == MK_MODULE; } +inline bool module_interface_p () +{ return module_kind & MK_INTERFACE; } +inline bool module_partition_p () +{ return module_kind & MK_PARTITION; } +inline bool module_has_cmi_p () +{ return module_kind & (MK_INTERFACE | MK_PARTITION); } + +/* We're currently exporting declarations. */ +inline bool module_exporting_p () +{ return module_kind & MK_EXPORTING; } + +extern module_state *get_module (tree name, module_state *parent = NULL, + bool partition = false); +extern bool module_may_redeclare (tree decl); + +extern int module_initializer_kind (); +extern void module_add_import_initializers (); + +/* Where the namespace-scope decl was originally declared. */ +extern void set_originating_module (tree, bool friend_p = false); +extern tree get_originating_module_decl (tree) ATTRIBUTE_PURE; +extern int get_originating_module (tree, bool for_mangle = false) ATTRIBUTE_PURE; +extern unsigned get_importing_module (tree, bool = false) ATTRIBUTE_PURE; + +/* Where current instance of the decl got declared/defined/instantiated. */ +extern void set_instantiating_module (tree); +extern void set_defining_module (tree); +extern void maybe_attach_decl (tree ctx, tree decl); + +extern void mangle_module (int m, bool include_partition); +extern void mangle_module_fini (); +extern void lazy_load_binding (unsigned mod, tree ns, tree id, + binding_slot *bslot); +extern void lazy_load_specializations (tree tmpl); +extern void lazy_load_members (tree decl); +extern bool lazy_specializations_p (unsigned, bool, bool); +extern module_state *preprocess_module (module_state *, location_t, + bool in_purview, + bool is_import, bool export_p, + cpp_reader *reader); +extern void preprocessed_module (cpp_reader *reader); +extern void import_module (module_state *, location_t, bool export_p, + tree attr, cpp_reader *); +extern void declare_module (module_state *, location_t, bool export_p, + tree attr, cpp_reader *); +extern void init_modules (cpp_reader *); +extern void fini_modules (); +extern void maybe_check_all_macros (cpp_reader *); +extern void finish_module_processing (cpp_reader *); +extern char const *module_name (unsigned, bool header_ok); +extern bitmap get_import_bitmap (); +extern bitmap module_visible_instantiation_path (bitmap *); +extern void module_begin_main_file (cpp_reader *, line_maps *, + const line_map_ordinary *); +extern void module_preprocess_options (cpp_reader *); +extern bool handle_module_option (unsigned opt, const char *arg, int value); /* In optimize.c */ extern bool maybe_clone_body (tree); @@ -7443,7 +7559,7 @@ extern bool is_local_temp (tree); extern tree build_aggr_init_expr (tree, tree); extern tree get_target_expr (tree); extern tree get_target_expr_sfinae (tree, tsubst_flags_t); -extern tree build_cplus_array_type (tree, tree, int is_dep = -1); +extern tree build_cplus_array_type (tree, tree); extern tree build_array_of_n_type (tree, int); extern bool array_of_runtime_bound_p (tree); extern bool vla_type_p (tree); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 1bc7b7e..46069cb 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1928,7 +1928,7 @@ static void clear_consteval_vfns (vec<tree> &consteval_vtables) { for (tree vtable : consteval_vtables) - for (constructor_elt &elt : *CONSTRUCTOR_ELTS (DECL_INITIAL (vtable))) + for (constructor_elt &elt : CONSTRUCTOR_ELTS (DECL_INITIAL (vtable))) { tree fn = cp_get_fndecl_from_callee (elt.value, /*fold*/false); if (fn && DECL_IMMEDIATE_FUNCTION_P (fn)) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 103567c..cc3da15 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -30611,9 +30611,6 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) { tree default_arg = TREE_PURPOSE (parm); tree parsed_arg; - vec<tree, va_gc> *insts; - tree copy; - unsigned ix; tree parmdecl = parms[i]; pushdecl (parmdecl); @@ -30633,8 +30630,7 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) TREE_PURPOSE (parm) = parsed_arg; /* Update any instantiations we've already created. */ - for (insts = DEFPARSE_INSTANTIATIONS (default_arg), ix = 0; - vec_safe_iterate (insts, ix, ©); ix++) + for (tree copy : DEFPARSE_INSTANTIATIONS (default_arg)) TREE_PURPOSE (copy) = parsed_arg; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3ca2813..2d3ab92 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -22,7 +22,9 @@ along with GCC; see the file COPYING3. If not see /* Known bugs or deficiencies include: all methods must be provided in header files; can't use a source - file that contains only the method templates and "just win". */ + file that contains only the method templates and "just win". + + Fixed by: C++20 modules. */ #include "config.h" #include "system.h" @@ -1702,19 +1704,16 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend, return spec; } -/* Restricts tree and type comparisons. */ -int comparing_specializations; -int comparing_typenames; - /* Returns true iff two spec_entry nodes are equivalent. */ +int comparing_specializations; + bool spec_hasher::equal (spec_entry *e1, spec_entry *e2) { int equal; ++comparing_specializations; - ++comparing_typenames; equal = (e1->tmpl == e2->tmpl && comp_template_args (e1->args, e2->args)); if (equal && flag_concepts @@ -1730,7 +1729,6 @@ spec_hasher::equal (spec_entry *e1, spec_entry *e2) equal = equivalent_constraints (c1, c2); } --comparing_specializations; - --comparing_typenames; return equal; } @@ -6044,6 +6042,14 @@ push_template_decl (tree decl, bool is_friend) tmpl = NULL_TREE; } } + else if (is_friend) + { + /* Record this decl as belonging to the current class. It's + not chained onto anything else. */ + DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P (tmpl) = true; + gcc_checking_assert (!DECL_CHAIN (tmpl)); + DECL_CHAIN (tmpl) = current_scope (); + } } else if (tmpl) /* The type may have been completed, or (erroneously) changed. */ @@ -8260,7 +8266,7 @@ convert_template_argument (tree parm, /* When determining whether an argument pack expansion is a template, look at the pattern. */ - if (TREE_CODE (arg) == TYPE_PACK_EXPANSION) + if (PACK_EXPANSION_P (arg)) arg = PACK_EXPANSION_PATTERN (arg); /* Deal with an injected-class-name used as a template template arg. */ @@ -11053,6 +11059,7 @@ tsubst_friend_function (tree decl, tree args) DECL_USE_TEMPLATE (new_friend) = 0; if (TREE_CODE (new_friend) == TEMPLATE_DECL) { + DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P (new_friend) = false; DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0; DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (new_friend)) = DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (decl)); @@ -29006,6 +29013,12 @@ do_class_deduction (tree ptype, tree tmpl, tree init, if (DECL_TEMPLATE_TEMPLATE_PARM_P (tmpl)) return ptype; + /* Initializing one placeholder from another. */ + if (init && TREE_CODE (init) == TEMPLATE_PARM_INDEX + && is_auto (TREE_TYPE (init)) + && CLASS_PLACEHOLDER_TEMPLATE (TREE_TYPE (init)) == tmpl) + return cp_build_qualified_type (TREE_TYPE (init), cp_type_quals (ptype)); + /* Look through alias templates that just rename another template. */ tmpl = get_underlying_template (tmpl); if (!ctad_template_p (tmpl)) @@ -29022,10 +29035,6 @@ do_class_deduction (tree ptype, tree tmpl, tree init, "with %<-std=c++20%> or %<-std=gnu++20%>"); } - if (init && TREE_TYPE (init) == ptype) - /* Using the template parm as its own argument. */ - return ptype; - tree type = TREE_TYPE (tmpl); bool try_list_ctor = false; @@ -29273,7 +29282,7 @@ do_auto_deduction (tree type, tree init, tree auto_node, /* We don't recurse here because we can't deduce from a nested initializer_list. */ if (CONSTRUCTOR_ELTS (init)) - for (constructor_elt &elt : *CONSTRUCTOR_ELTS (init)) + for (constructor_elt &elt : CONSTRUCTOR_ELTS (init)) elt.value = resolve_nondeduced_context (elt.value, complain); } else diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8d7df60..4e6bf9a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -998,7 +998,7 @@ build_min_array_type (tree elt_type, tree index_type) build_cplus_array_type. */ static void -set_array_type_canon (tree t, tree elt_type, tree index_type, bool dep) +set_array_type_canon (tree t, tree elt_type, tree index_type) { /* Set the canonical type for this new node. */ if (TYPE_STRUCTURAL_EQUALITY_P (elt_type) @@ -1009,33 +1009,30 @@ set_array_type_canon (tree t, tree elt_type, tree index_type, bool dep) TYPE_CANONICAL (t) = build_cplus_array_type (TYPE_CANONICAL (elt_type), index_type - ? TYPE_CANONICAL (index_type) : index_type, - dep); + ? TYPE_CANONICAL (index_type) : index_type); else TYPE_CANONICAL (t) = t; } /* Like build_array_type, but handle special C++ semantics: an array of a variant element type is a variant of the array of the main variant of - the element type. IS_DEPENDENT is -ve if we should determine the - dependency. Otherwise its bool value indicates dependency. */ + the element type. */ tree -build_cplus_array_type (tree elt_type, tree index_type, int dependent) +build_cplus_array_type (tree elt_type, tree index_type) { tree t; if (elt_type == error_mark_node || index_type == error_mark_node) return error_mark_node; - if (dependent < 0) - dependent = (uses_template_parms (elt_type) - || (index_type && uses_template_parms (index_type))); + bool dependent = (uses_template_parms (elt_type) + || (index_type && uses_template_parms (index_type))); if (elt_type != TYPE_MAIN_VARIANT (elt_type)) /* Start with an array of the TYPE_MAIN_VARIANT. */ t = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type), - index_type, dependent); + index_type); else if (dependent) { /* Since type_hash_canon calls layout_type, we need to use our own @@ -1065,20 +1062,13 @@ build_cplus_array_type (tree elt_type, tree index_type, int dependent) *e = t; /* Set the canonical type for this new node. */ - set_array_type_canon (t, elt_type, index_type, dependent); - - /* Mark it as dependent now, this saves time later. */ - TYPE_DEPENDENT_P_VALID (t) = true; - TYPE_DEPENDENT_P (t) = true; + set_array_type_canon (t, elt_type, index_type); } } else { bool typeless_storage = is_byte_access_type (elt_type); t = build_array_type (elt_type, index_type, typeless_storage); - - /* Mark as non-dependenty now, this will save time later. */ - TYPE_DEPENDENT_P_VALID (t) = true; } /* Now check whether we already have this array variant. */ @@ -1093,10 +1083,7 @@ build_cplus_array_type (tree elt_type, tree index_type, int dependent) if (!t) { t = build_min_array_type (elt_type, index_type); - /* Mark dependency now, this saves time later. */ - TYPE_DEPENDENT_P_VALID (t) = true; - TYPE_DEPENDENT_P (t) = dependent; - set_array_type_canon (t, elt_type, index_type, dependent); + set_array_type_canon (t, elt_type, index_type); if (!dependent) { layout_type (t); @@ -1332,10 +1319,7 @@ cp_build_qualified_type_real (tree type, if (!t) { - gcc_checking_assert (TYPE_DEPENDENT_P_VALID (type) - || !dependent_type_p (type)); - t = build_cplus_array_type (element_type, TYPE_DOMAIN (type), - TYPE_DEPENDENT_P (type)); + t = build_cplus_array_type (element_type, TYPE_DOMAIN (type)); /* Keep the typedef name. */ if (TYPE_NAME (t) != TYPE_NAME (type)) @@ -1571,9 +1555,7 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags) case ARRAY_TYPE: type = strip_typedefs (TREE_TYPE (t), remove_attributes, flags); t0 = strip_typedefs (TYPE_DOMAIN (t), remove_attributes, flags); - gcc_checking_assert (TYPE_DEPENDENT_P_VALID (t) - || !dependent_type_p (t)); - result = build_cplus_array_type (type, t0, TYPE_DEPENDENT_P (t)); + result = build_cplus_array_type (type, t0); break; case FUNCTION_TYPE: case METHOD_TYPE: @@ -2272,10 +2254,11 @@ ovl_make (tree fn, tree next) return result; } -/* Add FN to the (potentially NULL) overload set OVL. USING_OR_HIDDEN - is > 0, if FN is via a using declaration. USING_OR_HIDDEN is < 0, - if FN is hidden. (A decl cannot be both using and hidden.) We - keep the hidden decls first, but remaining ones are unordered. */ +/* Add FN to the (potentially NULL) overload set OVL. USING_OR_HIDDEN is > + zero if this is a using-decl. It is > 1 if we're exporting the + using decl. USING_OR_HIDDEN is < 0, if FN is hidden. (A decl + cannot be both using and hidden.) We keep the hidden decls first, + but remaining ones are unordered. */ tree ovl_insert (tree fn, tree maybe_ovl, int using_or_hidden) @@ -2299,7 +2282,11 @@ ovl_insert (tree fn, tree maybe_ovl, int using_or_hidden) if (using_or_hidden < 0) OVL_HIDDEN_P (maybe_ovl) = true; if (using_or_hidden > 0) - OVL_DEDUP_P (maybe_ovl) = OVL_USING_P (maybe_ovl) = true; + { + OVL_DEDUP_P (maybe_ovl) = OVL_USING_P (maybe_ovl) = true; + if (using_or_hidden > 1) + OVL_EXPORT_P (maybe_ovl) = true; + } } else maybe_ovl = fn; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 6294a78..267b284 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1256,15 +1256,16 @@ structural_comptypes (tree t1, tree t2, int strict) gcc_assert (TYPE_P (t1) && TYPE_P (t2)); - /* TYPENAME_TYPEs should be resolved if the qualifying scope is the - current instantiation, and we don't care about typename - structural equality. The comparing_typenames check is after the - code check, in order to early-out the common case. */ - if (TREE_CODE (t1) == TYPENAME_TYPE && !comparing_typenames) - t1 = resolve_typename_type (t1, /*only_current_p=*/true); - - if (TREE_CODE (t2) == TYPENAME_TYPE && !comparing_typenames) - t2 = resolve_typename_type (t2, /*only_current_p=*/true); + if (!comparing_specializations) + { + /* TYPENAME_TYPEs should be resolved if the qualifying scope is the + current instantiation. */ + if (TREE_CODE (t1) == TYPENAME_TYPE) + t1 = resolve_typename_type (t1, /*only_current_p=*/true); + + if (TREE_CODE (t2) == TYPENAME_TYPE) + t2 = resolve_typename_type (t2, /*only_current_p=*/true); + } if (TYPE_PTRMEMFUNC_P (t1)) t1 = TYPE_PTRMEMFUNC_FN_TYPE (t1); |