summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-08-16 17:58:53 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-08-16 17:58:53 +0000
commit055068df4a48e492ddcfd8ff7c47cd007ab15cb0 (patch)
treec9af1ed42d6a8fd6af42e649ec2490cd35ca498e /clang
parenta573c414356567618397e324b83c9b0ec9ce10c4 (diff)
downloadbcm5719-llvm-055068df4a48e492ddcfd8ff7c47cd007ab15cb0.tar.gz
bcm5719-llvm-055068df4a48e492ddcfd8ff7c47cd007ab15cb0.zip
Fix a crash when parsing malformed out-of-line member function
definition. radar 8307865. llvm-svn: 111163
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp5
-rw-r--r--clang/test/Parser/cxx-decl.cpp7
2 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index b0d9da58457..7149d4dc302 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -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
diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp
index e4c703c334b..e00ffd070fd 100644
--- a/clang/test/Parser/cxx-decl.cpp
+++ b/clang/test/Parser/cxx-decl.cpp
@@ -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}}
+}
OpenPOWER on IntegriCloud