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
This commit is contained in:
Jason Merrill 2009-04-08 12:08:15 -04:00 committed by Jason Merrill
parent b568955d9c
commit f6f5e3a1cc
4 changed files with 33 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 "" }
}