Commit 37d24376 by Douglas Gregor Committed by Doug Gregor

re PR c++/35113 (g++.dg/ext/vector13.C doesn't work)

2008-02-11  Douglas Gregor  <doug.gregor@gmail.com>

       PR c++/35113
       * tree.c (cp_build_qualified_type_real): When building a
       cv-qualified array type, build it as a unique type with
       build_cplus_array_type_1 and then adopt the unqualified type's
       main variant.

From-SVN: r132242
parent 5fd38b88
2008-02-11 Douglas Gregor <doug.gregor@gmail.com>
PR c++/35113
* tree.c (cp_build_qualified_type_real): When building a
cv-qualified array type, build it as a unique type with
build_cplus_array_type_1 and then adopt the unqualified type's
main variant.
2008-02-11 Paolo Carlini <pcarlini@suse.de> 2008-02-11 Paolo Carlini <pcarlini@suse.de>
PR c++/35077 PR c++/35077
......
...@@ -727,45 +727,31 @@ cp_build_qualified_type_real (tree type, ...@@ -727,45 +727,31 @@ cp_build_qualified_type_real (tree type,
if (!t) if (!t)
{ {
tree index_type = TYPE_DOMAIN (type); t = build_cplus_array_type_1 (element_type, TYPE_DOMAIN (type));
void **e;
cplus_array_info cai;
hashval_t hash;
if (cplus_array_htab == NULL) if (TYPE_MAIN_VARIANT (t) != TYPE_MAIN_VARIANT (type))
cplus_array_htab = htab_create_ggc (61, &cplus_array_hash, {
&cplus_array_compare, /* Set the main variant of the newly-created ARRAY_TYPE
NULL); (with cv-qualified element type) to the main variant of
the unqualified ARRAY_TYPE we started with. */
hash = (htab_hash_pointer (element_type) tree last_variant = t;
^ htab_hash_pointer (index_type)); tree m = TYPE_MAIN_VARIANT (type);
cai.type = element_type;
cai.domain = index_type;
e = htab_find_slot_with_hash (cplus_array_htab, &cai, hash, INSERT);
if (*e)
/* We have found the type: we're done. */
return (tree) *e;
/* Build a new array type and add it into the table. */ /* Find the last variant on the new ARRAY_TYPEs list of
t = build_variant_type_copy (type); variants, setting the main variant of each of the other
TREE_TYPE (t) = element_type; types to the main variant of our unqualified
*e = t; ARRAY_TYPE. */
while (TYPE_NEXT_VARIANT (last_variant))
{
TYPE_MAIN_VARIANT (last_variant) = m;
last_variant = TYPE_NEXT_VARIANT (last_variant);
}
/* Set the canonical type for this new node. */ /* Splice in the newly-created variants. */
if (TYPE_STRUCTURAL_EQUALITY_P (element_type) TYPE_NEXT_VARIANT (last_variant) = TYPE_NEXT_VARIANT (m);
|| (index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type))) TYPE_NEXT_VARIANT (m) = t;
SET_TYPE_STRUCTURAL_EQUALITY (t); TYPE_MAIN_VARIANT (last_variant) = m;
else if (TYPE_CANONICAL (element_type) != element_type }
|| (index_type
&& TYPE_CANONICAL (index_type) != index_type)
|| TYPE_CANONICAL (type) != type)
TYPE_CANONICAL (t)
= build_cplus_array_type
(TYPE_CANONICAL (element_type),
index_type? TYPE_CANONICAL (index_type) : index_type);
else
TYPE_CANONICAL (t) = t;
} }
/* Even if we already had this variant, we update /* Even if we already had this variant, we update
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment