aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-12-06 15:20:34 -0500
committerJason Merrill <jason@gcc.gnu.org>2012-12-06 15:20:34 -0500
commit0fe4913b32f81a2265c15976791059401ad938c8 (patch)
tree6b6cf5b4c93298b53e94a9550b9e965221f3ddaa /gcc
parent84fd832c033bea574a835ca680e7b84d2027798d (diff)
downloadgcc-0fe4913b32f81a2265c15976791059401ad938c8.zip
gcc-0fe4913b32f81a2265c15976791059401ad938c8.tar.gz
gcc-0fe4913b32f81a2265c15976791059401ad938c8.tar.bz2
re PR c++/55032 (Internal compiler error: in strip_typedefs, at cp/tree.c:1199)
PR c++/55032 * tree.c (build_array_type_1): Re-layout if we found it in the hash table. From-SVN: r194265
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/template/array24.C22
-rw-r--r--gcc/tree.c5
3 files changed, 33 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7da4e1f..cecd1ef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/55032
+ * tree.c (build_array_type_1): Re-layout if we found it in the
+ hash table.
+
2012-12-06 Jack Howarth <howarth@bromo.med.uc.edu>
PR 55599/sanitizer
diff --git a/gcc/testsuite/g++.dg/template/array24.C b/gcc/testsuite/g++.dg/template/array24.C
new file mode 100644
index 0000000..07879d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/array24.C
@@ -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);
+}
diff --git a/gcc/tree.c b/gcc/tree.c
index 7cacb2a..429db49 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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)