commit 429af9226fcba2450a8fbfcfba85801a38d0d129
Author: Jason Merrill <jason@redhat.com>
Date: Thu Dec 6 10:21:25 2012 -0500
PR c++/55032
* tree.c (build_array_type_1): Re-layout if we found it in the
hash table.
@@ -7505,7 +7505,12 @@ build_array_type_1 (tree elt_type, tree index_type, bool shared)
hashval_t hashcode = iterative_hash_object (TYPE_HASH (elt_type), 0);
if (index_type)
hashcode = iterative_hash_object (TYPE_HASH (index_type), hashcode);
+ tree old_t = t;
t = type_hash_canon (hashcode, t);
+ if (t != old_t)
+ /* Lay it out again in case the element type has been completed since
+ the array was added to the hash table. */
+ layout_type (t);
}
if (TYPE_CANONICAL (t) == t)
new file mode 100644
@@ -0,0 +1,22 @@
+// PR c++/55032
+
+template<typename T>
+struct vec3t {
+ T c[3];
+};
+
+typedef vec3t<float> vec3;
+
+class Bounds {
+ public:
+ Bounds(const vec3 bb[2]);
+ void foo(const vec3 & v) { v.c[0]; }
+};
+
+template<typename T>
+void work(T& value);
+
+void foo() {
+ vec3 bb[2];
+ work(bb);
+}