]> granicus.if.org Git - clang/commitdiff
Fix a crash when parsing malformed out-of-line member function
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 16 Aug 2010 17:58:53 +0000 (17:58 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 16 Aug 2010 17:58:53 +0000 (17:58 +0000)
definition. radar 8307865.

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

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

index b0d9da5845790cfcfcf8cc5e0119a4a132e6bf3c..7149d4dc3029d06106d797f36d6d7fa4d770f956 100644 (file)
@@ -2727,7 +2727,10 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
       if (Actions.ShouldEnterDeclaratorScope(getCurScope(), D.getCXXScopeSpec()))
         // Change the declaration context for name lookup, until this function
         // is exited (and the declarator has been parsed).
-        DeclScopeObj.EnterDeclaratorScope();
+        // If there was an error parsing parenthesized declarator, declarator
+        // scope may have been enterred before. Don't do it again.
+        if (!D.isInvalidType())
+          DeclScopeObj.EnterDeclaratorScope();
     }
   } else if (D.mayOmitIdentifier()) {
     // This could be something simple like "int" (in which case the declarator
index e4c703c334bd12552ff0831ae6004f8e3977b788..e00ffd070fd888aea0fd9924dc6d107d86d5f758 100644 (file)
@@ -76,3 +76,10 @@ class Class2 {
 }  // no ;
 
 typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}}
+
+// rdar : // 8307865
+struct CodeCompleteConsumer {
+};
+
+void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
+}