Commit 29fae15c by Mark Mitchell

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
parent 020a7b12
...@@ -650,10 +650,20 @@ cp_build_qualified_type_real (type, type_quals, complain) ...@@ -650,10 +650,20 @@ cp_build_qualified_type_real (type, type_quals, complain)
if (element_type == error_mark_node) if (element_type == error_mark_node)
return error_mark_node; return error_mark_node;
/* Make a new array type, just like the old one, but with the /* See if we already have an identically qualified type. */
appropriately qualified element type. */ for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
t = build_type_copy (type); if (cp_type_quals (t) == type_quals
TREE_TYPE (t) = element_type; && 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 /* Even if we already had this variant, we update
TYPE_NEEDS_CONSTRUCTING and TYPE_HAS_NONTRIVIAL_DESTRUCTOR in case TYPE_NEEDS_CONSTRUCTING and TYPE_HAS_NONTRIVIAL_DESTRUCTOR in case
......
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