diff mbox

[C++,obvious] PR 57638

Message ID 51C0F8CA.6030304@oracle.com
State New
Headers show

Commit Message

Paolo Carlini June 19, 2013, 12:18 a.m. UTC
Hi,

if there are no objections, tomorrow I will apply this patchlet from 
Manuel which I consider obvious. Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////
/cp
2013-06-19  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR c++/57638
	* pt.c (unify, [TEMPLATE_PARM_INDEX]): Pass to unify_type_mismatch
	TREE_TYPE (arg), not arg itself.

/testsuite
2013-06-19  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR c++/57638
	* g++.dg/template/error53.C: New.
diff mbox

Patch

Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 200178)
+++ cp/pt.c	(working copy)
@@ -16961,7 +16961,7 @@  unify (tree tparms, tree targs, tree parm, tree ar
 	   later.  */
 	return unify_success (explain_p);
       else
-	return unify_type_mismatch (explain_p, tparm, arg);
+	return unify_type_mismatch (explain_p, tparm, TREE_TYPE (arg));
 
       /* If ARG is a parameter pack or an expansion, we cannot unify
 	 against it unless PARM is also a parameter pack.  */
Index: testsuite/g++.dg/template/error53.C
===================================================================
--- testsuite/g++.dg/template/error53.C	(revision 0)
+++ testsuite/g++.dg/template/error53.C	(working copy)
@@ -0,0 +1,13 @@ 
+// PR c++/57638
+
+template<int x>
+struct S {};
+
+template<long long i>
+void g(S<i>);
+
+void f()
+{
+  S<1000> t;
+  g(t);         // { dg-error "no matching" }
+}  // { dg-message "mismatched types 'long long int' and 'int'" "" { target *-*-* } 12 }