Implement the rest of C++ [over.call.object], which permits the object
being called to be converted to a reference-to-function,
pointer-to-function, or reference-to-pointer-to-function. This is done
through "surrogate" candidate functions that model the conversions
from the object to the function (reference/pointer) and the
conversions in the arguments.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59674 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index 751c4af..cc3f315 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -134,3 +134,17 @@
 
   c(); // expected-error{{no matching function for call to object of type 'struct Callable'; candidates are:}}
 }
+
+typedef int& Func1(float, double);
+typedef float& Func2(int, double);
+
+struct ConvertToFunc {
+  operator Func1*(); // expected-note{{conversion candidate of type 'int &(*)(float, double)'}}
+  operator Func2&(); // expected-note{{conversion candidate of type 'float &(&)(int, double)'}}
+};
+
+void test_funcptr_call(ConvertToFunc ctf) {
+  int &i1 = ctf(1.0f, 2.0);
+  float &f2 = ctf((short int)1, 1.0f);
+  ctf((long int)17, 2.0); // expected-error{{error: call to object of type 'struct ConvertToFunc' is ambiguous; candidates are:}}
+}