Allow function calls to dereferenced member pointers of
pointer-to-function type. Fixes <rdar://problem/9065289>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 7ef3348..c208ed2 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4574,9 +4574,6 @@
return MaybeBindToTemporary(TheCall);
}
- return ExprError(Diag(Fn->getLocStart(),
- diag::err_typecheck_call_not_function)
- << Fn->getType() << Fn->getSourceRange());
}
}
}
diff --git a/test/SemaCXX/member-pointers-2.cpp b/test/SemaCXX/member-pointers-2.cpp
index 4b3b82c..6c39282 100644
--- a/test/SemaCXX/member-pointers-2.cpp
+++ b/test/SemaCXX/member-pointers-2.cpp
@@ -34,3 +34,18 @@
Test0 mytest;
mytest.test();
}
+
+namespace rdar9065289 {
+ typedef void (*FuncPtr)();
+ struct X0 { };
+
+ struct X1
+ {
+ X0* x0;
+ FuncPtr X0::*fptr;
+ };
+
+ void f(X1 p) {
+ (p.x0->*(p.fptr))();
+ }
+}