summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-28 04:31:30 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-28 04:31:30 +0000
commit4144f6a4f2595097f3a0f0f7db2d6f75ceada4f7 (patch)
tree89f30a03fe7a1937cac6a24f588836ec605a6c77 /gcc/cp
parentdb5aa3d02b58852d366ec422ae2d90fccbf00aa0 (diff)
downloadgcc-4144f6a4f2595097f3a0f0f7db2d6f75ceada4f7.tar.gz
PR c++/54652
* decl.c (duplicate_decls): Always use oldtype for TYPE_DECL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207169 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/decl.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 07f82ad97af..214cb579ff4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2014-01-27 Jason Merrill <jason@redhat.com>
+ PR c++/54652
+ * decl.c (duplicate_decls): Always use oldtype for TYPE_DECL.
+
PR c++/58504
* pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Use tsubst for
types.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7ebb05d451c..c93c7831a08 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1926,9 +1926,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* Merge the data types specified in the two decls. */
newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
- /* If merge_types produces a non-typedef type, just use the old type. */
- if (TREE_CODE (newdecl) == TYPE_DECL
- && newtype == DECL_ORIGINAL_TYPE (newdecl))
+ /* 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;
if (VAR_P (newdecl))