diff options
author | Mark Mitchell <mmitchel@gcc.gnu.org> | 2002-11-26 08:11:33 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2002-11-26 08:11:33 +0000 |
commit | 29fae15c80c65f731b37344d0e6989a9a42f89d8 (patch) | |
tree | 6c69b7279e8df5e99ab4f5362a4ae3bb520d94aa /gcc/cp | |
parent | 020a7b12f8cbe9df5b803e68b1741fb620a404f8 (diff) | |
download | gcc-29fae15c80c65f731b37344d0e6989a9a42f89d8.zip gcc-29fae15c80c65f731b37344d0e6989a9a42f89d8.tar.gz gcc-29fae15c80c65f731b37344d0e6989a9a42f89d8.tar.bz2 |
tree.c (cp_build_qualified_type_real): Correct handling of array types.
* tree.c (cp_build_qualified_type_real): Correct handling of
array types.
From-SVN: r59499
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/tree.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index b101ac6..6c313eb 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -650,10 +650,20 @@ cp_build_qualified_type_real (type, type_quals, complain) if (element_type == error_mark_node) return error_mark_node; - /* Make a new array type, just like the old one, but with the - appropriately qualified element type. */ - t = build_type_copy (type); - TREE_TYPE (t) = element_type; + /* See if we already have an identically qualified type. */ + for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t)) + if (cp_type_quals (t) == type_quals + && TYPE_NAME (t) == TYPE_NAME (type) + && TYPE_CONTEXT (t) == TYPE_CONTEXT (type)) + break; + + if (!t) + { + /* Make a new array type, just like the old one, but with the + appropriately qualified element type. */ + t = build_type_copy (type); + TREE_TYPE (t) = element_type; + } /* Even if we already had this variant, we update TYPE_NEEDS_CONSTRUCTING and TYPE_HAS_NONTRIVIAL_DESTRUCTOR in case |