diff options
author | Jason Merrill <jason@redhat.com> | 2009-04-08 12:08:15 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-04-08 12:08:15 -0400 |
commit | f6f5e3a1cc294a064bf87250db3dee449a24f278 (patch) | |
tree | 79752b2a66e9422d70efe39125b3a379bbca76e9 /gcc | |
parent | b568955d9c5ac37908ca4f3b808a5d58079c3196 (diff) | |
download | gcc-f6f5e3a1cc294a064bf87250db3dee449a24f278.zip gcc-f6f5e3a1cc294a064bf87250db3dee449a24f278.tar.gz gcc-f6f5e3a1cc294a064bf87250db3dee449a24f278.tar.bz2 |
re PR c++/25185 (deep typedef substitution in error message)
PR c++/25185
* error.c (dump_aggr_type): Chase template typedefs if
-fno-pretty-templates.
From-SVN: r145753
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/error.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/error40.C | 11 |
4 files changed, 33 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 22d1ced..b11e004 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2009-04-08 Jason Merrill <jason@redhat.com> + + PR c++/25185 + * error.c (dump_aggr_type): Chase template typedefs if + -fno-pretty-templates. + 2009-04-08 Dodji Seketeli <dodji@redhat.com> PR c++/39637 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index fc32d99..9c2e7e5 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -537,14 +537,22 @@ dump_aggr_type (tree t, int flags) if (flags & TFF_CLASS_KEY_OR_ENUM) pp_cxx_identifier (cxx_pp, variety); - if (flags & TFF_CHASE_TYPEDEF) - t = TYPE_MAIN_VARIANT (t); - name = TYPE_NAME (t); if (name) { typdef = !DECL_ARTIFICIAL (name); + + if (typdef + && ((flags & TFF_CHASE_TYPEDEF) + || (!flag_pretty_templates && DECL_LANG_SPECIFIC (name) + && DECL_TEMPLATE_INFO (name)))) + { + t = TYPE_MAIN_VARIANT (t); + name = TYPE_NAME (t); + typdef = 0; + } + tmplate = !typdef && TREE_CODE (t) != ENUMERAL_TYPE && TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t) && (TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48269e9..646ee1f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-04-08 Jason Merrill <jason@redhat.com> + + PR c++/25185 + * g++.dg/template/error40.C: Add another test. + 2009-04-08 Joseph Myers <joseph@codesourcery.com> PR c/39614 diff --git a/gcc/testsuite/g++.dg/template/error40.C b/gcc/testsuite/g++.dg/template/error40.C index f449832..c5df56f 100644 --- a/gcc/testsuite/g++.dg/template/error40.C +++ b/gcc/testsuite/g++.dg/template/error40.C @@ -3,6 +3,7 @@ template <class T, int N=0, int X=1> struct A { + struct AN; }; void foo(void) @@ -13,7 +14,17 @@ void foo(void) template <class T> T f(T); // { dg-message "int f<int>.int." } template <class T> T f(T, int = 0); // { dg-message "" } +template <class T> +struct B +{ + typedef typename T::AN BN; + + BN f(); // { dg-message "AN" } + BN f(int = 0); // { dg-message "" } +}; + int main() { f(1); // { dg-error "" } + B<A<int> >().f(); // { dg-error "" } } |