+2011-03-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/48029
+ * stor-layout.c (layout_type): Don't set structural equality
+ on arrays of incomplete type.
+ * tree.c (type_hash_eq): Handle comparing them properly.
+
2011-03-10 Jakub Jelinek <jakub@redhat.com>
PR debug/48043
- * config/s390/s390.c (s390_delegitimize_address): Make sure the
+ * config/s390/s390.c (s390_delegitimize_address): Make sure the
result mode matches original rtl mode.
2011-03-10 Nick Clifton <nickc@redhat.com>
2011-03-10 Jason Merrill <jason@redhat.com>
+ PR c++/48029
+ * pt.c (iterative_hash_template_arg): Remove special case for
+ ARRAY_TYPE.
+
PR c++/47198
* parser.c (cp_parser_single_declaration): Just return if
cp_parser_parse_and_diagnose_invalid_type_name complained.
val = iterative_hash_object (code, val);
return iterative_hash_template_arg (TREE_OPERAND (arg, 2), val);
- case ARRAY_TYPE:
- /* layout_type sets structural equality for arrays of
- incomplete type, so we can't rely on the canonical type
- for hashing. */
- val = iterative_hash_template_arg (TREE_TYPE (arg), val);
- return iterative_hash_template_arg (TYPE_DOMAIN (arg), val);
-
case LAMBDA_EXPR:
/* A lambda can't appear in a template arg, but don't crash on
erroneous input. */
#else
TYPE_ALIGN (type) = MAX (TYPE_ALIGN (element), BITS_PER_UNIT);
#endif
- if (!TYPE_SIZE (element))
- /* We don't know the size of the underlying element type, so
- our alignment calculations will be wrong, forcing us to
- fall back on structural equality. */
- SET_TYPE_STRUCTURAL_EQUALITY (type);
TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (element);
SET_TYPE_MODE (type, BLKmode);
if (TYPE_SIZE (type) != 0
2011-03-10 Jason Merrill <jason@redhat.com>
+ * g++.dg/template/array22.C: New.
+
* g++.dg/cpp0x/syntax-err1.C: New.
* g++.dg/parse/error36.C: Adjust expected errors.
* g++.old-deja/g++.pt/ctor2.C: Likewise.
--- /dev/null
+// PR c++/48029
+
+template <class T> struct A { };
+template <class T, class U> struct B
+{
+ struct N { };
+ typedef U u;
+};
+
+typedef B<int, A<int>(*)[2]> btype;
+A<int> v1[2];
+btype v2;
+
+
|| TREE_TYPE (a->type) != TREE_TYPE (b->type)
|| !attribute_list_equal (TYPE_ATTRIBUTES (a->type),
TYPE_ATTRIBUTES (b->type))
- || TYPE_ALIGN (a->type) != TYPE_ALIGN (b->type)
- || TYPE_MODE (a->type) != TYPE_MODE (b->type)
|| (TREE_CODE (a->type) != COMPLEX_TYPE
&& TYPE_NAME (a->type) != TYPE_NAME (b->type)))
return 0;
+ /* Be careful about comparing arrays before and after the element type
+ has been completed; don't compare TYPE_ALIGN unless both types are
+ complete. */
+ if (COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (a->type)
+ && COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (b->type)
+ && (TYPE_ALIGN (a->type) != TYPE_ALIGN (b->type)
+ || TYPE_MODE (a->type) != TYPE_MODE (b->type)))
+ return 0;
+
switch (TREE_CODE (a->type))
{
case VOID_TYPE: