Commit 9e4c469a by Jason Merrill Committed by Jason Merrill

decl.c (duplicate_decls): When combining typedefs, remove the new type from the variants list.

	* decl.c (duplicate_decls): When combining typedefs, remove the
	new type from the variants list.

From-SVN: r230202
parent c7360ed2
2015-11-11 Jason Merrill <jason@redhat.com> 2015-11-11 Jason Merrill <jason@redhat.com>
* decl.c (duplicate_decls): When combining typedefs, remove the
new type from the variants list.
2015-11-11 Jason Merrill <jason@redhat.com>
* pt.c (instantiate_class_template_1): Set function_depth around * pt.c (instantiate_class_template_1): Set function_depth around
instantiation of lambda op(). instantiation of lambda op().
......
...@@ -2014,7 +2014,22 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -2014,7 +2014,22 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* For typedefs use the old type, as the new type's DECL_NAME points /* For typedefs use the old type, as the new type's DECL_NAME points
at newdecl, which will be ggc_freed. */ at newdecl, which will be ggc_freed. */
if (TREE_CODE (newdecl) == TYPE_DECL) if (TREE_CODE (newdecl) == TYPE_DECL)
newtype = oldtype; {
newtype = oldtype;
/* And remove the new type from the variants list. */
if (TYPE_NAME (TREE_TYPE (newdecl)) == newdecl)
{
tree remove = TREE_TYPE (newdecl);
for (tree t = TYPE_MAIN_VARIANT (remove); ;
t = TYPE_NEXT_VARIANT (t))
if (TYPE_NEXT_VARIANT (t) == remove)
{
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove);
break;
}
}
}
else else
/* Merge the data types specified in the two decls. */ /* Merge the data types specified in the two decls. */
newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
......
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