Emit error when using a bound member function for something other than calling it.

Also avoids IRGen crashes due to accepting invalid code.

llvm-svn: 117943
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index ddee9cc..4c586e5 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -74,6 +74,12 @@
   if (!E)
     return;
 
+  if (E->isBoundMemberFunction(Context)) {
+    Diag(E->getLocStart(), diag::err_invalid_use_of_bound_member_func)
+      << E->getSourceRange();
+    return;
+  }
+
   SourceLocation Loc;
   SourceRange R1, R2;
   if (!E->isUnusedResultAWarning(Loc, R1, R2, Context))