summaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2009-01-22 07:15:41 +0000
committerDodji Seketeli <dodji@gcc.gnu.org>2009-01-22 08:15:41 +0100
commit03c2a308f32b01bdb5bea5538bccbb9b885b47a9 (patch)
tree8c0ca9e4a8b6ac8aced92cf10fba12e1269c35c1 /gcc/cp/name-lookup.c
parent73cc93abd2d93d6d5dcbfb8654bc7718a13c2476 (diff)
downloadgcc-03c2a308f32b01bdb5bea5538bccbb9b885b47a9.tar.gz
Reverted commit 143546 related to PR c++/26693
From-SVN: r143562
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 2c69cfe68a6..f8d0204f099 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -847,20 +847,28 @@ pushdecl_maybe_friend (tree x, bool is_friend)
/* If declaring a type as a typedef, copy the type (unless we're
at line 0), and install this TYPE_DECL as the new type's typedef
- name. See the extensive comment of set_underlying_type (). */
+ name. See the extensive comment in ../c-decl.c (pushdecl). */
if (TREE_CODE (x) == TYPE_DECL)
{
tree type = TREE_TYPE (x);
-
- if (DECL_IS_BUILTIN (x)
- || (TREE_TYPE (x) != error_mark_node
- && TYPE_NAME (type) != x
- /* We don't want to copy the type when all we're
- doing is making a TYPE_DECL for the purposes of
- inlining. */
- && (!TYPE_NAME (type)
- || TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x))))
- set_underlying_type (x);
+ if (DECL_IS_BUILTIN (x))
+ {
+ if (TYPE_NAME (type) == 0)
+ TYPE_NAME (type) = x;
+ }
+ else if (type != error_mark_node && TYPE_NAME (type) != x
+ /* We don't want to copy the type when all we're
+ doing is making a TYPE_DECL for the purposes of
+ inlining. */
+ && (!TYPE_NAME (type)
+ || TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
+ {
+ DECL_ORIGINAL_TYPE (x) = type;
+ type = build_variant_type_copy (type);
+ TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x));
+ TYPE_NAME (type) = x;
+ TREE_TYPE (x) = type;
+ }
if (type != error_mark_node
&& TYPE_NAME (type)