* error.c (dump_type): Improve typedef handling.
authorJason Merrill <jason@redhat.com>
Wed, 2 Jun 2010 19:19:31 +0000 (15:19 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 2 Jun 2010 19:19:31 +0000 (15:19 -0400)
From-SVN: r160184

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/vector9.C

index 8b883e7..09bbe68 100644 (file)
@@ -1,5 +1,7 @@
 2010-06-02  Jason Merrill  <jason@redhat.com>
 
+       * error.c (dump_type): Improve typedef handling.
+
        PR c++/9726
        PR c++/23594
        PR c++/44333
index 592f360..381163b 100644 (file)
@@ -329,6 +329,25 @@ dump_type (tree t, int flags)
   if (t == NULL_TREE)
     return;
 
+  /* Don't print e.g. "struct mytypedef".  */
+  if (TYPE_P (t) && typedef_variant_p (t))
+    {
+      tree decl = TYPE_NAME (t);
+      if ((flags & TFF_CHASE_TYPEDEF)
+         || DECL_SELF_REFERENCE_P (decl)
+         || (!flag_pretty_templates
+             && DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)))
+       t = strip_typedefs (t);
+      else if (same_type_p (t, TREE_TYPE (decl)))
+       t = decl;
+      else
+       {
+         pp_cxx_cv_qualifier_seq (cxx_pp, t);
+         pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
+         return;
+       }
+    }
+
   if (TYPE_PTRMEMFUNC_P (t))
     goto offset_type;
 
index dba6f87..00a6ad6 100644 (file)
@@ -1,5 +1,7 @@
 2010-06-02  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/ext/vector9.C: Expect typedef in error message.
+
        PR c++/9726
        PR c++/23594
        PR c++/44333
index 32e13b4..52b3f17 100644 (file)
@@ -6,5 +6,5 @@ typedef int   v4i __attribute__((vector_size(8)));
 void foo()
 {
   v4f v;
-  !(v4i)v; // { dg-error "__vector.2. int|argument" }
+  !(v4i)v; // { dg-error "v4i|argument" }
 }