Hi,
for c++/51230 I tried to change unify_inconsistency to unconditionally
use %qE but apparently that doesn't really work: quickly we end up
duplicating the whole dump_type inside dump_expr, first POINTER_TYPE (as
per this specific PR), and then REFERENCE_TYPE, and then OFFSET_TYPE,
and then pointers to member functions are not handled correctly, etc. I
guess, better just checking TYPE_P and be done with it.
Tested x86_64-linux. Ok?
Thanks,
Paolo.
////////////////////
/cp
2011-11-30 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51367
* pt.c (unify_inconsistency): Use either %qT or %qE depending on
whether parm is a type or non-type parameter.
/cp
2011-11-30 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51367
* g++.dg/template/error47.C: New.
Index: testsuite/g++.dg/template/error47.C
===================================================================
--- testsuite/g++.dg/template/error47.C (revision 0)
+++ testsuite/g++.dg/template/error47.C (revision 0)
@@ -0,0 +1,9 @@
+// PR c++/51367
+
+template<typename T> void foo(T, T); // { dg-message "template" }
+
+void bar(void* p)
+{
+ foo(0, p); // { dg-error "no matching" }
+}
+// { dg-message "candidate|parameter 'T' ('int' and 'void*')" { target *-*-* }
7 }
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 181858)
+++ cp/pt.c (working copy)
@@ -5501,9 +5501,16 @@ static int
unify_inconsistency (bool explain_p, tree parm, tree first, tree second)
{
if (explain_p)
- inform (input_location,
- " conflicting deductions for parameter %qE (%qE and %qE)",
- parm, first, second);
+ {
+ if (TYPE_P (parm))
+ inform (input_location,
+ " deduced conflicting types for parameter %qT (%qT and %qT)",
+ parm, first, second);
+ else
+ inform (input_location,
+ " deduced conflicting values for non-type parameter "
+ "%qE (%qE and %qE)", parm, first, second);
+ }
return 1;
}