diff options
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 01bc483..3c7bbb1 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 |