https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65690
--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
This is better version of the patch that at least seems to survive early stages
of bootstrap ;)
Index: tree.c
===================================================================
--- tree.c (revision 221909)
+++ tree.c (working copy)
@@ -1053,26 +1053,16 @@ cp_build_qualified_type_real (tree type,
if (element_type == error_mark_node)
return error_mark_node;
- /* See if we already have an identically qualified type. Tests
- should be equivalent to those in check_qualified_type. */
+ /* See if we already have an identically qualified type. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
if (TREE_TYPE (t) == element_type
- && TYPE_NAME (t) == TYPE_NAME (type)
- && TYPE_CONTEXT (t) == TYPE_CONTEXT (type)
- && attribute_list_equal (TYPE_ATTRIBUTES (t),
- TYPE_ATTRIBUTES (type)))
+ && check_base_type (t, type))
break;
if (!t)
{
- t = build_cplus_array_type (element_type, TYPE_DOMAIN (type));
-
- /* Keep the typedef name. */
- if (TYPE_NAME (t) != TYPE_NAME (type))
- {
- t = build_variant_type_copy (t);
- TYPE_NAME (t) = TYPE_NAME (type);
- }
+ t = build_variant_type_copy (type);
+ TREE_TYPE (t) = element_type;
}
/* Even if we already had this variant, we update