[cfe-commits] r127739 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/member-pointers-2.cpp

Douglas Gregor dgregor at apple.com
Wed Mar 16 10:42:23 PDT 2011


Author: dgregor
Date: Wed Mar 16 12:42:23 2011
New Revision: 127739

URL: http://llvm.org/viewvc/llvm-project?rev=127739&view=rev
Log:
Allow function calls to dereferenced member pointers of
pointer-to-function type. Fixes <rdar://problem/9065289>.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/SemaCXX/member-pointers-2.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=127739&r1=127738&r2=127739&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Mar 16 12:42:23 2011
@@ -4574,9 +4574,6 @@
 
           return MaybeBindToTemporary(TheCall);
         }
-        return ExprError(Diag(Fn->getLocStart(),
-                              diag::err_typecheck_call_not_function)
-                              << Fn->getType() << Fn->getSourceRange());
       }
     }
   }

Modified: cfe/trunk/test/SemaCXX/member-pointers-2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-pointers-2.cpp?rev=127739&r1=127738&r2=127739&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/member-pointers-2.cpp (original)
+++ cfe/trunk/test/SemaCXX/member-pointers-2.cpp Wed Mar 16 12:42:23 2011
@@ -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))();
+  }
+}





More information about the cfe-commits mailing list