Commit e34b0922 by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/17344 (completely wacky error with matching template template classes…

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
parent 18ccc7e0
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> 2004-11-12 Mark Mitchell <mark@codesourcery.com>
PR c++/18389 PR c++/18389
......
...@@ -4007,7 +4007,10 @@ coerce_template_parms (tree parms, ...@@ -4007,7 +4007,10 @@ coerce_template_parms (tree parms,
gcc_assert (arg); gcc_assert (arg);
if (arg == error_mark_node) 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 else
arg = convert_template_argument (TREE_VALUE (parm), arg = convert_template_argument (TREE_VALUE (parm),
arg, new_args, complain, i, arg, new_args, complain, i,
......
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> 2004-11-13 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/parse/cast1.C: Run only on ILP32. * g++.dg/parse/cast1.C: Run only on ILP32.
......
// { 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);
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