diff mbox

C++ PATCH for c++/54652 (ICE with repeated typedef/attribute)

Message ID 52E7E391.2010907@redhat.com
State New
Headers show

Commit Message

Jason Merrill Jan. 28, 2014, 5:06 p.m. UTC
It occurred to me that we don't need to call merge_types at all if we're 
just going to throw away the result.
diff mbox

Patch

commit 00a4445cf80b647d14144c9b509cf06d052a888e
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Jan 28 08:50:23 2014 -0500

    	* decl.c (duplicate_decls): Tweak.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c93c783..aca96fc 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1923,13 +1923,13 @@  duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
       if (TREE_CODE (newdecl) == FUNCTION_DECL)
 	maybe_instantiate_noexcept (olddecl);
 
-      /* Merge the data types specified in the two decls.  */
-      newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
-
       /* For typedefs use the old type, as the new type's DECL_NAME points
 	 at newdecl, which will be ggc_freed.  */
       if (TREE_CODE (newdecl) == TYPE_DECL)
 	newtype = oldtype;
+      else
+	/* Merge the data types specified in the two decls.  */
+	newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
 
       if (VAR_P (newdecl))
 	{