decl.c (build_ptrmemfunc_type): Keep variant chain intact.

2009-08-16  Richard Guenther  <rguenther@suse.de>

	* decl.c (build_ptrmemfunc_type): Keep variant chain intact.
	Avoid useless copy.
	(finish_enum): Keep variant chain intact.
	* tree.c (cp_build_reference_type): Likewise.

From-SVN: r150839
This commit is contained in:
Richard Guenther 2009-08-17 11:03:59 +00:00 committed by Richard Biener
parent 241bea2641
commit 22521c89b6
3 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2009-08-17 Richard Guenther <rguenther@suse.de>
* decl.c (build_ptrmemfunc_type): Keep variant chain intact.
Avoid useless copy.
(finish_enum): Keep variant chain intact.
* tree.c (cp_build_reference_type): Likewise.
2009-08-16 Jason Merrill <jason@redhat.com>
Make TREE_USED match the [basic.def.odr] concept for FUNCTION_DECL

View file

@ -7056,10 +7056,14 @@ build_ptrmemfunc_type (tree type)
/* If this is not the unqualified form of this pointer-to-member
type, set the TYPE_MAIN_VARIANT for this type to be the
unqualified type. Since they are actually RECORD_TYPEs that are
not variants of each other, we must do this manually. */
not variants of each other, we must do this manually.
As we just built a new type there is no need to do yet another copy. */
if (cp_type_quals (type) != TYPE_UNQUALIFIED)
{
t = build_qualified_type (t, cp_type_quals (type));
int type_quals = cp_type_quals (type);
TYPE_READONLY (t) = (type_quals & TYPE_QUAL_CONST) != 0;
TYPE_VOLATILE (t) = (type_quals & TYPE_QUAL_VOLATILE) != 0;
TYPE_RESTRICT (t) = (type_quals & TYPE_QUAL_RESTRICT) != 0;
TYPE_MAIN_VARIANT (t) = unqualified_variant;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
TYPE_NEXT_VARIANT (unqualified_variant) = t;
@ -11164,7 +11168,8 @@ finish_enum (tree enumtype)
/* Set the underlying type of the enumeration type to the
computed enumeration type, restricted to the enumerator
values. */
ENUM_UNDERLYING_TYPE (enumtype) = copy_node (underlying_type);
ENUM_UNDERLYING_TYPE (enumtype)
= build_distinct_type_copy (underlying_type);
set_min_and_max_values_for_integral_type
(ENUM_UNDERLYING_TYPE (enumtype), precision, unsignedp);
}

View file

@ -700,12 +700,11 @@ cp_build_reference_type (tree to_type, bool rval)
if (TYPE_REF_IS_RVALUE (t))
return t;
t = copy_node (lvalue_ref);
t = build_distinct_type_copy (lvalue_ref);
TYPE_REF_IS_RVALUE (t) = true;
TYPE_NEXT_REF_TO (t) = TYPE_NEXT_REF_TO (lvalue_ref);
TYPE_NEXT_REF_TO (lvalue_ref) = t;
TYPE_MAIN_VARIANT (t) = t;
if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
SET_TYPE_STRUCTURAL_EQUALITY (t);