Parser: Avoid a crash-on-invalid when trying to diagnose function calls with -> in it.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 10 Oct 2013 12:24:40 +0000 (12:24 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 10 Oct 2013 12:24:40 +0000 (12:24 +0000)
Use the existing convenience function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192347 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
test/Parser/cxx-decl.cpp

index c9a718b5278735c4060a460693f0fa0f2f00a1eb..a82d5cea63590146ef63b73d67315ecef092b6e1 100644 (file)
@@ -1468,8 +1468,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
         const Type* BaseType = Base->getType().getTypePtrOrNull();
         if (BaseType && Tok.is(tok::l_paren) &&
             (BaseType->isFunctionType() ||
-             BaseType->getAsPlaceholderType()->getKind() ==
-                 BuiltinType::BoundMember)) {
+             BaseType->isSpecificPlaceholderType(BuiltinType::BoundMember))) {
           Diag(OpLoc, diag::err_function_is_not_record)
             << (OpKind == tok::arrow) << Base->getSourceRange()
             << FixItHint::CreateRemoval(OpLoc);
index c33a8d561cafc76f217ae2878bb0c5dc0eebe878..ea20354bf9a75bcda922076f94013660f4d542a6 100644 (file)
@@ -202,6 +202,12 @@ namespace test7 {
   // Comment!
 }
 
+void test8() {
+  struct {} o;
+  // This used to crash.
+  (&o)->(); // expected-error{{expected unqualified-id}}
+}
+
 namespace PR5066 {
   template<typename T> struct X {};
   X<int N> x; // expected-error {{type-id cannot have a name}}