Commit f6f5e3a1 by Jason Merrill Committed by Jason Merrill

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
parent b568955d
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> 2009-04-08 Dodji Seketeli <dodji@redhat.com>
PR c++/39637 PR c++/39637
......
...@@ -537,14 +537,22 @@ dump_aggr_type (tree t, int flags) ...@@ -537,14 +537,22 @@ dump_aggr_type (tree t, int flags)
if (flags & TFF_CLASS_KEY_OR_ENUM) if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_cxx_identifier (cxx_pp, variety); pp_cxx_identifier (cxx_pp, variety);
if (flags & TFF_CHASE_TYPEDEF)
t = TYPE_MAIN_VARIANT (t);
name = TYPE_NAME (t); name = TYPE_NAME (t);
if (name) if (name)
{ {
typdef = !DECL_ARTIFICIAL (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 tmplate = !typdef && TREE_CODE (t) != ENUMERAL_TYPE
&& TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t) && TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t)
&& (TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL && (TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL
......
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> 2009-04-08 Joseph Myers <joseph@codesourcery.com>
PR c/39614 PR c/39614
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
template <class T, int N=0, int X=1> template <class T, int N=0, int X=1>
struct A struct A
{ {
struct AN;
}; };
void foo(void) void foo(void)
...@@ -13,7 +14,17 @@ 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); // { dg-message "int f<int>.int." }
template <class T> T f(T, int = 0); // { dg-message "" } 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() int main()
{ {
f(1); // { dg-error "" } f(1); // { dg-error "" }
B<A<int> >().f(); // { dg-error "" }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment