re PR c++/17344 (completely wacky error with matching template template classes and default arguments)

PR c++/17344
	* pt.c (coerce_template_parms): Only emit error message about
	invalid template argument when TF_ERROR.

	* g++.dg/template/defarg5.C: New test.

From-SVN: r90615
This commit is contained in:
Kriang Lerdsuwanakij 2004-11-14 10:57:00 +00:00 committed by Kriang Lerdsuwanakij
parent 18ccc7e0e3
commit e34b09225a
4 changed files with 40 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2004-11-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/17344
* pt.c (coerce_template_parms): Only emit error message about
invalid template argument when TF_ERROR.
2004-11-12 Mark Mitchell <mark@codesourcery.com>
PR c++/18389

View File

@ -4007,7 +4007,10 @@ coerce_template_parms (tree parms,
gcc_assert (arg);
if (arg == error_mark_node)
error ("template argument %d is invalid", i + 1);
{
if (complain & tf_error)
error ("template argument %d is invalid", i + 1);
}
else
arg = convert_template_argument (TREE_VALUE (parm),
arg, new_args, complain, i,

View File

@ -1,3 +1,8 @@
2004-11-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/17344
* g++.dg/template/defarg5.C: New test.
2004-11-13 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/parse/cast1.C: Run only on ILP32.

View File

@ -0,0 +1,25 @@
// { dg-do compile }
// Origin: Ivan Godard <igodard@pacbell.net>
// Wolfgang Bangerth <bangerth@dealii.org>
// PR c++/17344: Substitution failure is not an error
// for default template argument
template <class> struct intTraits;
template<> struct intTraits<int> {
static const int i = 0;
};
template<typename E, E i = intTraits<E>::i> struct A {};
struct S {
template <template <typename> class X> S(X<void>);
};
int bar(S);
int bar(A<int,0>);
A<int> bed;
int i = bar(bed);