Hi,
apparently in the new deductions notes we are not handling correctly
non-type parameters in some messages, like in:
template<int> struct A {};
template<int N> void foo(A<N>, A<N>);
void bar()
{
foo(A<0>(), A<1>());
}
we use %qT in unify_inconsistency and the output is garbled. The below
is the most compact fix I have been able to figure out, but of course
other solutions are possible, like separate error messages for non-type
(TYPE_P (parm) to tell which appears to work fine), etc. Tested
x86_64-linux.
Thanks,
Paolo.
//////////////////////
/cp
2011-11-20 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51230
* pt.c (unify_inconsistency): Handle non-type parameters better.
/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/pt.c
===================================================================
--- cp/pt.c (revision 181521)
+++ 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;
}