When performing template argument deduction of a function template
against a function type, be sure to check the type of the resulting
function template specialization against the desired function type
after substituting the deduced/defaulted template arguments. Fixes PR8196.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115086 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp
index 46bdf8e..ab80d8f 100644
--- a/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -104,3 +104,15 @@
   // expected-error{{cannot initialize a variable of type}}
 
 }
+
+namespace PR8196 {
+  template <typename T> struct mcdata {
+    typedef int result_type;
+  };
+  template <class T> 
+    typename mcdata<T>::result_type wrap_mean(mcdata<T> const&);
+  void add_property(double(*)(mcdata<double> const &)); // expected-note{{candidate function not viable: no overload of 'wrap_mean' matching}}
+  void f() {
+    add_property(&wrap_mean); // expected-error{{no matching function for call to 'add_property'}}
+  }
+}