+2006-08-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/28659
+ * typeck.c (merge_types): If either of the types have the right
+ attributes, return that one.
+
+ * tree.c (cp_build_type_attribute_variant): Make sure we aren't
+ doing this to class types.
+ * typeck.c (original_type): Deal with type quals properly.
+
2006-08-21 Jason Merrill <jason@redhat.com>
PR c++/27115
!= TYPE_RAISES_EXCEPTIONS (type)))
new_type = build_exception_variant (new_type,
TYPE_RAISES_EXCEPTIONS (type));
+
+ /* Making a new main variant of a class type is broken. */
+ gcc_assert (!CLASS_TYPE_P (type) || new_type == type);
+
return new_type;
}
static tree
original_type (tree t)
{
+ int quals = cp_type_quals (t);
while (t != error_mark_node
&& TYPE_NAME (t) != NULL_TREE)
{
break;
t = x;
}
- return t;
+ return cp_build_qualified_type (t, quals);
}
/* T1 and T2 are arithmetic or enumeration types. Return the type
default:;
}
- return cp_build_type_attribute_variant (t1, attributes);
+
+ if (attribute_list_equal (TYPE_ATTRIBUTES (t1), attributes))
+ return t1;
+ else if (attribute_list_equal (TYPE_ATTRIBUTES (t2), attributes))
+ return t2;
+ else
+ return cp_build_type_attribute_variant (t1, attributes);
}
/* Return the common type of two types.
--- /dev/null
+// PR c++/28659
+// The attribute was causing us to get confused in merge_types when
+// combining the template type with an uninstantiated version.
+
+template<class T>
+struct __attribute__((aligned(1))) A
+{
+ A& operator=(const A &t);
+};
+
+template<class T>
+A<T>& A<T>::operator=(const A<T> &t)
+{
+}