Diagnose misuse of '.*' and '->*' operators during parse
instead of crashing in code gen.

llvm-svn: 84968
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 8be89a8..7d056fd 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -340,7 +340,18 @@
       // Eat the colon.
       ColonLoc = ConsumeToken();
     }
-
+    
+    if ((OpToken.is(tok::periodstar) || OpToken.is(tok::arrowstar))
+         && Tok.is(tok::identifier)) {
+      CXXScopeSpec SS;
+      if (Actions.getTypeName(*Tok.getIdentifierInfo(),
+                                           Tok.getLocation(), CurScope, &SS)) {
+        const char *Opc = OpToken.is(tok::periodstar) ? "'.*'" : "'->*'";
+        Diag(OpToken, diag::err_pointer_to_member_type) << Opc;
+        return ExprError();
+      }
+        
+    }
     // Parse another leaf here for the RHS of the operator.
     // ParseCastExpression works here because all RHS expressions in C have it
     // as a prefix, at least. However, in C++, an assignment-expression could