aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-07-17 17:34:06 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-07-17 17:34:06 -0400
commit697c474c8fadce131f79b662a79a454959d02c39 (patch)
tree54c48a3bdc7020c28e9b84caca3583760736ed5b /gcc/cp/tree.c
parent7fe3aa081150a5d140a8a6276b659aa906ad0cd5 (diff)
downloadgcc-697c474c8fadce131f79b662a79a454959d02c39.zip
gcc-697c474c8fadce131f79b662a79a454959d02c39.tar.gz
gcc-697c474c8fadce131f79b662a79a454959d02c39.tar.bz2
re PR c++/53989 (Internal compiler error in strip_typedefs, at cp/tree.c:1187)
PR c++/53989 * tree.c (build_cplus_array_type): Also add TYPE_CANONICAL to the list of variants. From-SVN: r189587
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 01bc483..3c7bbb132 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -803,12 +803,23 @@ build_cplus_array_type (tree elt_type, tree index_type)
{
tree m = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type),
index_type);
+ tree c = TYPE_CANONICAL (t);
+
if (TYPE_MAIN_VARIANT (t) != m)
{
TYPE_MAIN_VARIANT (t) = m;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
TYPE_NEXT_VARIANT (m) = t;
}
+
+ /* If we built a new array type for TYPE_CANONICAL, add
+ that to the list of variants as well. */
+ if (c && c != t && TYPE_MAIN_VARIANT (c) != m)
+ {
+ TYPE_MAIN_VARIANT (c) = m;
+ TYPE_NEXT_VARIANT (c) = t;
+ TYPE_NEXT_VARIANT (m) = c;
+ }
}
/* Push these needs up so that initialization takes place