Hi,
Hmm, if %qE supports types, I guess we might as well use that. OK.
essentially it works because of these lines in dump_expr:
case TEMPLATE_TYPE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
dump_type (t, flags);
break;
note, however, that this means TEMPLATE_TEMPLATE_PARM is not handled,
thus something like the below would lead to garbled output again:
template<typename> struct A;
template<typename> struct B;
template<template<typename> class> struct C {};
template<template<typename> class T> void foo(C<T>, C<T>);
void bar()
{
foo(C<A>(), C<B>());
}
sorry for noticing yesterday. Thus I propose to apply the below instead.
Paolo.
/////////////////
/cp
2011-11-20 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51230
* pt.c (unify_inconsistency): Handle non-type parameters better.
* error.c (dump_expr): Handle TEMPLATE_TEMPLATE_PARM.
/cp
2011-11-20 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51230
* g++.dg/template/error46.C: New.
Index: testsuite/g++.dg/template/error46.C
===================================================================
--- testsuite/g++.dg/template/error46.C (revision 0)
+++ testsuite/g++.dg/template/error46.C (revision 0)
@@ -0,0 +1,11 @@
+// PR c++/51230
+
+template<int> struct A {};
+
+template<int N> void foo(A<N>, A<N>); // { dg-message "template" }
+
+void bar()
+{
+ foo(A<0>(), A<1>()); // { dg-error "no matching" }
+}
+// { dg-message "candidate|parameter 'N' ('0' and '1')" { target *-*-* } 9 }
Index: cp/error.c
===================================================================
--- cp/error.c (revision 181530)
+++ cp/error.c (working copy)
@@ -2406,6 +2406,7 @@ dump_expr (tree t, int flags)
break;
case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
dump_type (t, flags);
break;
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 181530)
+++ cp/pt.c (working copy)
@@ -5501,7 +5501,7 @@ unify_inconsistency (bool explain_p, tree parm, tr
{
if (explain_p)
inform (input_location,
- " deduced conflicting types for parameter %qT (%qT and %qT)",
+ " conflicting deductions for parameter %qE (%qE and %qE)",
parm, first, second);
return 1;
}