diff mbox

[C++] PR 51230

Message ID 4EC91EA6.9030805@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Nov. 20, 2011, 3:37 p.m. UTC
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.carlini@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.carlini@oracle.com>

	PR c++/51230
	* g++.dg/template/error46.C: New.

Comments

Jason Merrill Nov. 20, 2011, 9:51 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

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;
 }