re PR c++/23293 (Misleading names in diagnostics for typedefs in functions)

PR c++/23293
	* pt.c (convert_template_argument): Use canonical type variants in
	template specializations.
	PR c++/23293
	* g++.dg/template/error19.C: New test.

From-SVN: r105561
This commit is contained in:
Mark Mitchell 2005-10-18 15:39:12 +00:00 committed by Mark Mitchell
parent c19aaba573
commit 685e39c289
4 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-10-18 Mark Mitchell <mark@codesourcery.com>
PR c++/23293
* pt.c (convert_template_argument): Use canonical type variants in
template specializations.
2005-10-18 Nathan Sidwell <nathan@codesourcery.com>
PR c++/21383

View File

@ -3930,6 +3930,13 @@ convert_template_argument (tree parm,
}
else
val = arg;
/* We only form one instance of each template specialization.
Therefore, if we use a non-canonical variant (i.e., a
typedef), any future messages referring to the type will use
the typedef, which is confusing if those future uses do not
themselves also use the typedef. */
if (TYPE_P (val))
val = canonical_type_variant (val);
}
else
{

View File

@ -1,3 +1,8 @@
2005-10-18 Mark Mitchell <mark@codesourcery.com>
PR c++/23293
* g++.dg/template/error19.C: New test.
2005-10-18 Nathan Sidwell <nathan@codesourcery.com>
PR c++/21383

View File

@ -0,0 +1,22 @@
// PR c++/23293
template < typename > struct P;
struct S;
void *unrelated_function()
{
typedef S K;
P < K > * p;
return p;
}
template < typename U >
void generate_warning()
{
U::x(); // { dg-error "P<S>" }
}
int main()
{
generate_warning< P < S > >();
}