OSDN Git Service

PR c++/54325
[pf3gnuchains/gcc-fork.git] / gcc / cp / tree.c
index 707f2c8..0341956 100644 (file)
@@ -1,7 +1,7 @@
 /* Language-dependent node constructors for parse phase of GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011,
+   2012 Free Software Foundation, Inc.
    Hacked by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GCC.
@@ -150,8 +150,14 @@ lvalue_kind (const_tree ref)
       /* A scope ref in a template, left as SCOPE_REF to support later
         access checking.  */
     case SCOPE_REF:
-      gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE(ref)));
-      return lvalue_kind (TREE_OPERAND (ref, 1));
+      {
+       tree op = TREE_OPERAND (ref, 1);
+       /* The member must be an lvalue; assume it isn't a bit-field.  */
+       if (TREE_CODE (op) == IDENTIFIER_NODE)
+         return clk_ordinary;
+       gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE (ref)));
+       return lvalue_kind (op);
+      }
 
     case MAX_EXPR:
     case MIN_EXPR:
@@ -203,10 +209,13 @@ lvalue_kind (const_tree ref)
       return lvalue_kind (BASELINK_FUNCTIONS (CONST_CAST_TREE (ref)));
 
     case NON_DEPENDENT_EXPR:
-      /* We used to just return clk_ordinary for NON_DEPENDENT_EXPR because
-        it was safe enough for C++98, but in C++0x lvalues don't bind to
-        rvalue references, so we get bogus errors (c++/44870).  */
-      return lvalue_kind (TREE_OPERAND (ref, 0));
+      /* We just return clk_ordinary for NON_DEPENDENT_EXPR in C++98, but
+        in C++11 lvalues don't bind to rvalue references, so we need to
+        work harder to avoid bogus errors (c++/44870).  */
+      if (cxx_dialect < cxx0x)
+       return clk_ordinary;
+      else
+       return lvalue_kind (TREE_OPERAND (ref, 0));
 
     default:
       if (!TREE_TYPE (ref))
@@ -387,18 +396,13 @@ build_aggr_init_array (tree return_type, tree fn, tree slot, int nargs,
    callable.  */
 
 tree
-build_aggr_init_expr (tree type, tree init, tsubst_flags_t complain)
+build_aggr_init_expr (tree type, tree init, tsubst_flags_t /*complain*/)
 {
   tree fn;
   tree slot;
   tree rval;
   int is_ctor;
 
-  /* Make sure that we're not trying to create an instance of an
-     abstract class.  */
-  if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain))
-    return error_mark_node;
-
   if (TREE_CODE (init) == CALL_EXPR)
     fn = CALL_EXPR_FN (init);
   else if (TREE_CODE (init) == AGGR_INIT_EXPR)
@@ -457,6 +461,11 @@ build_cplus_new (tree type, tree init, tsubst_flags_t complain)
   tree rval = build_aggr_init_expr (type, init, complain);
   tree slot;
 
+  /* Make sure that we're not trying to create an instance of an
+     abstract class.  */
+  if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain))
+    return error_mark_node;
+
   if (TREE_CODE (rval) == AGGR_INIT_EXPR)
     slot = AGGR_INIT_EXPR_SLOT (rval);
   else if (TREE_CODE (rval) == CALL_EXPR
@@ -504,7 +513,8 @@ build_vec_init_elt (tree type, tree init, tsubst_flags_t complain)
   argvec = make_tree_vector ();
   if (init)
     {
-      tree dummy = build_dummy_object (inner_type);
+      tree init_type = strip_array_types (TREE_TYPE (init));
+      tree dummy = build_dummy_object (init_type);
       if (!real_lvalue_p (init))
        dummy = move (dummy);
       VEC_quick_push (tree, argvec, dummy);
@@ -561,7 +571,7 @@ diagnose_non_constexpr_vec_init (tree expr)
   tree type = TREE_TYPE (VEC_INIT_EXPR_SLOT (expr));
   tree init, elt_init;
   if (VEC_INIT_EXPR_VALUE_INIT (expr))
-    init = void_zero_node;
+    init = void_type_node;
   else
     init = VEC_INIT_EXPR_INIT (expr);
 
@@ -777,7 +787,18 @@ build_cplus_array_type (tree elt_type, tree index_type)
        }
     }
   else
-    t = build_array_type (elt_type, index_type);
+    {
+      if (!TYPE_STRUCTURAL_EQUALITY_P (elt_type)
+         && !(index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type))
+         && (TYPE_CANONICAL (elt_type) != elt_type
+             || (index_type && TYPE_CANONICAL (index_type) != index_type)))
+       /* Make sure that the canonical type is on the appropriate
+          variants list.  */
+       build_cplus_array_type
+         (TYPE_CANONICAL (elt_type),
+          index_type ? TYPE_CANONICAL (index_type) : index_type);
+      t = build_array_type (elt_type, index_type);
+    }
 
   /* We want TYPE_MAIN_VARIANT of an array to strip cv-quals from the
      element type as well, so fix it up if needed.  */
@@ -785,6 +806,7 @@ build_cplus_array_type (tree elt_type, tree index_type)
     {
       tree m = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type),
                                       index_type);
+
       if (TYPE_MAIN_VARIANT (t) != m)
        {
          TYPE_MAIN_VARIANT (t) = m;
@@ -1076,7 +1098,7 @@ cv_unqualified (tree type)
     * If T is a type that needs structural equality
       its TYPE_CANONICAL (T) will be NULL.
     * TYPE_CANONICAL (T) desn't carry type attributes
-      and looses template parameter names.   */
+      and loses template parameter names.   */
 
 tree
 strip_typedefs (tree t)
@@ -1166,6 +1188,16 @@ strip_typedefs (tree t)
                                   TYPENAME_TYPE_FULLNAME (t),
                                   typename_type, tf_none);
       break;
+    case DECLTYPE_TYPE:
+      result = strip_typedefs_expr (DECLTYPE_TYPE_EXPR (t));
+      if (result == DECLTYPE_TYPE_EXPR (t))
+       return t;
+      else
+       result = (finish_decltype_type
+                 (result,
+                  DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t),
+                  tf_none));
+      break;
     default:
       break;
     }
@@ -1187,6 +1219,186 @@ strip_typedefs (tree t)
   return cp_build_qualified_type (result, cp_type_quals (t));
 }
 
+/* Like strip_typedefs above, but works on expressions, so that in
+
+   template<class T> struct A
+   {
+     typedef T TT;
+     B<sizeof(TT)> b;
+   };
+
+   sizeof(TT) is replaced by sizeof(T).  */
+
+tree
+strip_typedefs_expr (tree t)
+{
+  unsigned i,n;
+  tree r, type, *ops;
+  enum tree_code code;
+
+  if (t == NULL_TREE || t == error_mark_node)
+    return t;
+
+  if (DECL_P (t) || CONSTANT_CLASS_P (t))
+    return t;
+
+  /* Some expressions have type operands, so let's handle types here rather
+     than check TYPE_P in multiple places below.  */
+  if (TYPE_P (t))
+    return strip_typedefs (t);
+
+  code = TREE_CODE (t);
+  switch (code)
+    {
+    case IDENTIFIER_NODE:
+    case TEMPLATE_PARM_INDEX:
+    case OVERLOAD:
+    case BASELINK:
+    case ARGUMENT_PACK_SELECT:
+      return t;
+
+    case TRAIT_EXPR:
+      {
+       tree type1 = strip_typedefs (TRAIT_EXPR_TYPE1 (t));
+       tree type2 = strip_typedefs (TRAIT_EXPR_TYPE2 (t));
+       if (type1 == TRAIT_EXPR_TYPE1 (t)
+           && type2 == TRAIT_EXPR_TYPE2 (t))
+         return t;
+       r = copy_node (t);
+       TRAIT_EXPR_TYPE1 (t) = type1;
+       TRAIT_EXPR_TYPE2 (t) = type2;
+       return r;
+      }
+
+    case TREE_LIST:
+      {
+       VEC(tree,gc) *vec = make_tree_vector ();
+       bool changed = false;
+       tree it;
+       for (it = t; it; it = TREE_CHAIN (it))
+         {
+           tree val = strip_typedefs_expr (TREE_VALUE (t));
+           VEC_safe_push (tree, gc, vec, val);
+           if (val != TREE_VALUE (t))
+             changed = true;
+           gcc_assert (TREE_PURPOSE (it) == NULL_TREE);
+         }
+       if (changed)
+         {
+           r = NULL_TREE;
+           FOR_EACH_VEC_ELT_REVERSE (tree, vec, i, it)
+             r = tree_cons (NULL_TREE, it, r);
+         }
+       else
+         r = t;
+       release_tree_vector (vec);
+       return r;
+      }
+
+    case TREE_VEC:
+      {
+       bool changed = false;
+       VEC(tree,gc)* vec = make_tree_vector ();
+       n = TREE_VEC_LENGTH (t);
+       VEC_reserve (tree, gc, vec, n);
+       for (i = 0; i < n; ++i)
+         {
+           tree op = strip_typedefs_expr (TREE_VEC_ELT (t, i));
+           VEC_quick_push (tree, vec, op);
+           if (op != TREE_VEC_ELT (t, i))
+             changed = true;
+         }
+       if (changed)
+         {
+           r = copy_node (t);
+           for (i = 0; i < n; ++i)
+             TREE_VEC_ELT (r, i) = VEC_index (tree, vec, i);
+         }
+       else
+         r = t;
+       release_tree_vector (vec);
+       return r;
+      }
+
+    case CONSTRUCTOR:
+      {
+       bool changed = false;
+       VEC(constructor_elt,gc) *vec
+         = VEC_copy (constructor_elt, gc, CONSTRUCTOR_ELTS (t));
+       n = CONSTRUCTOR_NELTS (t);
+       type = strip_typedefs (TREE_TYPE (t));
+       for (i = 0; i < n; ++i)
+         {
+           constructor_elt *e = VEC_index (constructor_elt, vec, i);
+           tree op = strip_typedefs_expr (e->value);
+           if (op != e->value)
+             {
+               changed = true;
+               e->value = op;
+             }
+           gcc_checking_assert (e->index == strip_typedefs_expr (e->index));
+         }
+
+       if (!changed && type == TREE_TYPE (t))
+         {
+           VEC_free (constructor_elt, gc, vec);
+           return t;
+         }
+       else
+         {
+           r = copy_node (t);
+           TREE_TYPE (r) = type;
+           CONSTRUCTOR_ELTS (r) = vec;
+           return r;
+         }
+      }
+
+    case LAMBDA_EXPR:
+      gcc_unreachable ();
+
+    default:
+      break;
+    }
+
+  gcc_assert (EXPR_P (t));
+
+  n = TREE_OPERAND_LENGTH (t);
+  ops = XALLOCAVEC (tree, n);
+  type = TREE_TYPE (t);
+
+  switch (code)
+    {
+    CASE_CONVERT:
+    case IMPLICIT_CONV_EXPR:
+    case DYNAMIC_CAST_EXPR:
+    case STATIC_CAST_EXPR:
+    case CONST_CAST_EXPR:
+    case REINTERPRET_CAST_EXPR:
+    case CAST_EXPR:
+    case NEW_EXPR:
+      type = strip_typedefs (type);
+      /* fallthrough */
+
+    default:
+      for (i = 0; i < n; ++i)
+       ops[i] = strip_typedefs_expr (TREE_OPERAND (t, i));
+      break;
+    }
+
+  /* If nothing changed, return t.  */
+  for (i = 0; i < n; ++i)
+    if (ops[i] != TREE_OPERAND (t, i))
+      break;
+  if (i == n && type == TREE_TYPE (t))
+    return t;
+
+  r = copy_node (t);
+  TREE_TYPE (r) = type;
+  for (i = 0; i < n; ++i)
+    TREE_OPERAND (r, i) = ops[i];
+  return r;
+}
+
 /* Makes a copy of BINFO and TYPE, which is to be inherited into a
    graph dominated by T.  If BINFO is NULL, TYPE is a dependent base,
    and we do a shallow copy.  If BINFO is non-NULL, we do a deep copy.
@@ -1225,12 +1437,11 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt)
   TREE_CHAIN (*igo_prev) = new_binfo;
   *igo_prev = new_binfo;
 
-  if (binfo)
+  if (binfo && !BINFO_DEPENDENT_BASE_P (binfo))
     {
       int ix;
       tree base_binfo;
 
-      gcc_assert (!BINFO_DEPENDENT_BASE_P (binfo));
       gcc_assert (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), type));
 
       BINFO_OFFSET (new_binfo) = BINFO_OFFSET (binfo);
@@ -1243,8 +1454,6 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt)
       for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
        {
          tree new_base_binfo;
-
-         gcc_assert (!BINFO_DEPENDENT_BASE_P (base_binfo));
          new_base_binfo = copy_binfo (base_binfo, BINFO_TYPE (base_binfo),
                                       t, igo_prev,
                                       BINFO_VIRTUAL_P (base_binfo));
@@ -1454,12 +1663,14 @@ is_overloaded_fn (tree x)
    (14.6.2), return the IDENTIFIER_NODE for that name.  Otherwise, return
    NULL_TREE.  */
 
-static tree
+tree
 dependent_name (tree x)
 {
   if (TREE_CODE (x) == IDENTIFIER_NODE)
     return x;
   if (TREE_CODE (x) != COMPONENT_REF
+      && TREE_CODE (x) != OFFSET_REF
+      && TREE_CODE (x) != BASELINK
       && is_overloaded_fn (x))
     return DECL_NAME (get_first_fn (x));
   return NULL_TREE;
@@ -1520,6 +1731,24 @@ build_overload (tree decl, tree chain)
   return ovl_cons (decl, chain);
 }
 
+/* Return the scope where the overloaded functions OVL were found.  */
+
+tree
+ovl_scope (tree ovl)
+{
+  if (TREE_CODE (ovl) == OFFSET_REF
+      || TREE_CODE (ovl) == COMPONENT_REF)
+    ovl = TREE_OPERAND (ovl, 1);
+  if (TREE_CODE (ovl) == BASELINK)
+    return BINFO_TYPE (BASELINK_BINFO (ovl));
+  if (TREE_CODE (ovl) == TEMPLATE_ID_EXPR)
+    ovl = TREE_OPERAND (ovl, 0);
+  /* Skip using-declarations.  */
+  while (TREE_CODE (ovl) == OVERLOAD && OVL_USED (ovl) && OVL_CHAIN (ovl))
+    ovl = OVL_CHAIN (ovl);
+  return CP_DECL_CONTEXT (OVL_CURRENT (ovl));
+}
+
 /* Return TRUE if FN is a non-static member function, FALSE otherwise.
    This function looks into BASELINK and OVERLOAD nodes.  */
 
@@ -1889,6 +2118,10 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
        u = build_target_expr_with_type (TREE_OPERAND (t, 1), TREE_TYPE (t),
                                         tf_warning_or_error);
 
+      TARGET_EXPR_IMPLICIT_P (u) = TARGET_EXPR_IMPLICIT_P (t);
+      TARGET_EXPR_LIST_INIT_P (u) = TARGET_EXPR_LIST_INIT_P (t);
+      TARGET_EXPR_DIRECT_INIT_P (u) = TARGET_EXPR_DIRECT_INIT_P (t);
+
       /* Map the old variable to the new one.  */
       splay_tree_insert (target_remap,
                         (splay_tree_key) TREE_OPERAND (t, 0),
@@ -1937,6 +2170,20 @@ bot_replace (tree* t,
         parsing with the real one for this function.  */
       *t = current_class_ptr;
     }
+  else if (TREE_CODE (*t) == CONVERT_EXPR
+          && CONVERT_EXPR_VBASE_PATH (*t))
+    {
+      /* In an NSDMI build_base_path defers building conversions to virtual
+        bases, and we handle it here.  */
+      tree basetype = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (*t)));
+      VEC(tree,gc) *vbases = CLASSTYPE_VBASECLASSES (current_class_type);
+      int i; tree binfo;
+      FOR_EACH_VEC_ELT (tree, vbases, i, binfo)
+       if (BINFO_TYPE (binfo) == basetype)
+         break;
+      *t = build_base_path (PLUS_EXPR, TREE_OPERAND (*t, 0), binfo, true,
+                           tf_warning_or_error);
+    }
 
   return NULL_TREE;
 }
@@ -2133,6 +2380,33 @@ decl_anon_ns_mem_p (const_tree decl)
     }
 }
 
+/* Subroutine of cp_tree_equal: t1 and t2 are the CALL_EXPR_FNs of two
+   CALL_EXPRS.  Return whether they are equivalent.  */
+
+static bool
+called_fns_equal (tree t1, tree t2)
+{
+  /* Core 1321: dependent names are equivalent even if the overload sets
+     are different.  But do compare explicit template arguments.  */
+  tree name1 = dependent_name (t1);
+  tree name2 = dependent_name (t2);
+  if (name1 || name2)
+    {
+      tree targs1 = NULL_TREE, targs2 = NULL_TREE;
+
+      if (name1 != name2)
+       return false;
+
+      if (TREE_CODE (t1) == TEMPLATE_ID_EXPR)
+       targs1 = TREE_OPERAND (t1, 1);
+      if (TREE_CODE (t2) == TEMPLATE_ID_EXPR)
+       targs2 = TREE_OPERAND (t2, 1);
+      return cp_tree_equal (targs1, targs2);
+    }
+  else
+    return cp_tree_equal (t1, t2);
+}
+
 /* Return truthvalue of whether T1 is the same tree structure as T2.
    Return 1 if they are the same. Return 0 if they are different.  */
 
@@ -2220,12 +2494,7 @@ cp_tree_equal (tree t1, tree t2)
       {
        tree arg1, arg2;
        call_expr_arg_iterator iter1, iter2;
-       /* Core 1321: dependent names are equivalent even if the
-          overload sets are different.  */
-       tree name1 = dependent_name (CALL_EXPR_FN (t1));
-       tree name2 = dependent_name (CALL_EXPR_FN (t2));
-       if (!(name1 && name2 && name1 == name2)
-           && !cp_tree_equal (CALL_EXPR_FN (t1), CALL_EXPR_FN (t2)))
+       if (!called_fns_equal (CALL_EXPR_FN (t1), CALL_EXPR_FN (t2)))
          return false;
        for (arg1 = first_call_expr_arg (t1, &iter1),
               arg2 = first_call_expr_arg (t2, &iter2);
@@ -2288,6 +2557,7 @@ cp_tree_equal (tree t1, tree t2)
 
     case VAR_DECL:
     case CONST_DECL:
+    case FIELD_DECL:
     case FUNCTION_DECL:
     case TEMPLATE_DECL:
     case IDENTIFIER_NODE:
@@ -2297,13 +2567,11 @@ cp_tree_equal (tree t1, tree t2)
     case BASELINK:
       return (BASELINK_BINFO (t1) == BASELINK_BINFO (t2)
              && BASELINK_ACCESS_BINFO (t1) == BASELINK_ACCESS_BINFO (t2)
+             && BASELINK_QUALIFIED_P (t1) == BASELINK_QUALIFIED_P (t2)
              && cp_tree_equal (BASELINK_FUNCTIONS (t1),
                                BASELINK_FUNCTIONS (t2)));
 
     case TEMPLATE_PARM_INDEX:
-      if (TEMPLATE_PARM_NUM_SIBLINGS (t1)
-         != TEMPLATE_PARM_NUM_SIBLINGS (t2))
-       return false;
       return (TEMPLATE_PARM_IDX (t1) == TEMPLATE_PARM_IDX (t2)
              && TEMPLATE_PARM_LEVEL (t1) == TEMPLATE_PARM_LEVEL (t2)
              && (TEMPLATE_PARM_PARAMETER_PACK (t1)
@@ -2312,26 +2580,18 @@ cp_tree_equal (tree t1, tree t2)
                              TREE_TYPE (TEMPLATE_PARM_DECL (t2))));
 
     case TEMPLATE_ID_EXPR:
+      return (cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0))
+             && cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1)));
+
+    case TREE_VEC:
       {
        unsigned ix;
-       tree vec1, vec2;
-
-       if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)))
+       if (TREE_VEC_LENGTH (t1) != TREE_VEC_LENGTH (t2))
          return false;
-       vec1 = TREE_OPERAND (t1, 1);
-       vec2 = TREE_OPERAND (t2, 1);
-
-       if (!vec1 || !vec2)
-         return !vec1 && !vec2;
-
-       if (TREE_VEC_LENGTH (vec1) != TREE_VEC_LENGTH (vec2))
-         return false;
-
-       for (ix = TREE_VEC_LENGTH (vec1); ix--;)
-         if (!cp_tree_equal (TREE_VEC_ELT (vec1, ix),
-                             TREE_VEC_ELT (vec2, ix)))
+       for (ix = TREE_VEC_LENGTH (t1); ix--;)
+         if (!cp_tree_equal (TREE_VEC_ELT (t1, ix),
+                             TREE_VEC_ELT (t2, ix)))
            return false;
-
        return true;
       }
 
@@ -2986,11 +3246,13 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
 
     case TYPE_PACK_EXPANSION:
       WALK_SUBTREE (TREE_TYPE (*tp));
+      WALK_SUBTREE (PACK_EXPANSION_EXTRA_ARGS (*tp));
       *walk_subtrees_p = 0;
       break;
       
     case EXPR_PACK_EXPANSION:
       WALK_SUBTREE (TREE_OPERAND (*tp, 0));
+      WALK_SUBTREE (PACK_EXPANSION_EXTRA_ARGS (*tp));
       *walk_subtrees_p = 0;
       break;
 
@@ -3210,6 +3472,11 @@ stabilize_expr (tree exp, tree* initp)
 
   if (!TREE_SIDE_EFFECTS (exp))
     init_expr = NULL_TREE;
+  else if (VOID_TYPE_P (TREE_TYPE (exp)))
+    {
+      *initp = exp;
+      return void_zero_node;
+    }
   /* There are no expressions with REFERENCE_TYPE, but there can be call
      arguments with such a type; just treat it as a pointer.  */
   else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE
@@ -3328,6 +3595,7 @@ stabilize_init (tree init, tree *initp)
 
   if (TREE_CODE (t) == INIT_EXPR
       && TREE_CODE (TREE_OPERAND (t, 1)) != TARGET_EXPR
+      && TREE_CODE (TREE_OPERAND (t, 1)) != CONSTRUCTOR
       && TREE_CODE (TREE_OPERAND (t, 1)) != AGGR_INIT_EXPR)
     {
       TREE_OPERAND (t, 1) = stabilize_expr (TREE_OPERAND (t, 1), initp);
@@ -3381,7 +3649,7 @@ stabilize_init (tree init, tree *initp)
 
   /* The initialization is being performed via a bitwise copy -- and
      the item copied may have side effects.  */
-  return TREE_SIDE_EFFECTS (init);
+  return !TREE_SIDE_EFFECTS (init);
 }
 
 /* Like "fold", but should be used whenever we might be processing the
@@ -3469,17 +3737,6 @@ cp_free_lang_data (tree t)
       DECL_EXTERNAL (t) = 1;
       TREE_STATIC (t) = 0;
     }
-  if (CP_AGGREGATE_TYPE_P (t)
-      && TYPE_NAME (t))
-    {
-      tree name = TYPE_NAME (t);
-      if (TREE_CODE (name) == TYPE_DECL)
-       name = DECL_NAME (name);
-      /* Drop anonymous names.  */
-      if (name != NULL_TREE
-         && ANON_AGGRNAME_P (name))
-       TYPE_NAME (t) = NULL_TREE;
-    }
   if (TREE_CODE (t) == NAMESPACE_DECL)
     {
       /* The list of users of a namespace isn't useful for the middle-end