diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8b883e7656e772fc92ac98abd154053bf6ff5c84..09bbe6849c27478139a8f405c4edf9493c08038b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 592f360001af1e98d0fdf5a5f1764454cb961b20..381163b2daf6148141a15417a9789d46ebd49bd5 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dba6f87bb4a1c878f4fef0f6a05601b2d9a73da8..00a6ad63f252e86a035a2a6636f8046ed73db85c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/ext/vector9.C b/gcc/testsuite/g++.dg/ext/vector9.C index 32e13b494f04f69689859799e6b0685db84c152f..52b3f1714444ad9373ea871269468c4b9c1d7726 100644 --- a/gcc/testsuite/g++.dg/ext/vector9.C +++ b/gcc/testsuite/g++.dg/ext/vector9.C @@ -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" } }