===================================================================
@@ -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. */
===================================================================
@@ -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 }