Patchwork [C++] PR 57327

login
register
mail settings
Submitter Paolo Carlini
Date May 19, 2013, 11:14 a.m.
Message ID <5198B3FB.8020508@oracle.com>
Download mbox | patch
Permalink /patch/244804/
State New
Headers show

Comments

Paolo Carlini - May 19, 2013, 11:14 a.m.
Hi,

a simple issue noticed by Jon, swap the arguments to inform. Tested 
x86_64-linux.

Thanks,
Paolo.

////////////////////////
/cp
2013-05-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/57327
	* pt.c (unify_no_common_base): Swap arg and parm arguments to inform.

/testsuite
2013-05-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/57327
	* g++.dg/template/error50.C: New.
Jason Merrill - May 20, 2013, 1:41 a.m.
OK.

Jason

Patch

Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 199076)
+++ cp/pt.c	(working copy)
@@ -5375,7 +5375,7 @@  unify_no_common_base (bool explain_p, enum templat
       {
       case tbr_ambiguous_baseclass:
 	inform (input_location, "  %qT is an ambiguous base class of %qT",
-		arg, parm);
+		parm, arg);
 	break;
       default:
 	inform (input_location, "  %qT is not derived from %qT", arg, parm);
Index: testsuite/g++.dg/template/error50.C
===================================================================
--- testsuite/g++.dg/template/error50.C	(revision 0)
+++ testsuite/g++.dg/template/error50.C	(working copy)
@@ -0,0 +1,19 @@ 
+// PR c++/57327
+
+template<class T>
+struct A {};
+
+template<class T>
+void f(A<T>&) {}
+
+struct B : A<long> {};
+
+struct C : A<char> {};
+
+struct D : B, C {};
+
+int main()
+{
+  D d;
+  f(d);  // { dg-error "no matching" }
+}        // { dg-message "'A<T>' is an ambiguous base" "" { target *-*-* } 18 }