]> granicus.if.org Git - clang/commitdiff
Don't crash on access decls with invalid scope specifier, PR20887.
authorNico Weber <nicolasweber@gmx.de>
Wed, 10 Sep 2014 00:59:37 +0000 (00:59 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 10 Sep 2014 00:59:37 +0000 (00:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217472 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp
test/Parser/cxx-class.cpp

index 497f7e06ddc48a9f18138e13e3df3cd1e540e244..b252ed5865c0e57fe01c4e1a915e32473122f33f 100644 (file)
@@ -2072,6 +2072,11 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
       ParseOptionalCXXScopeSpecifier(SS, ParsedType(), 
                                      /*EnteringContext=*/false);
 
+      if (SS.isInvalid()) {
+        SkipUntil(tok::semi);
+        return;
+      }
+
       // Try to parse an unqualified-id.
       SourceLocation TemplateKWLoc;
       UnqualifiedId Name;
index 7e820f17aad8ed84ca3f63bd92135034595e4083..b6eb1b46db51cadd7e946f9c5ab4a74898e4e483 100644 (file)
@@ -174,6 +174,11 @@ class PR20760_b {
   int f = d // expected-warning {{extension}} expected-error {{expected ';'}}
 };
 
+namespace PR20887 {
+class X1 { a::operator=; }; // expected-error {{undeclared identifier 'a'}}
+class X2 { a::a; }; // expected-error {{undeclared identifier 'a'}}
+}
+
 // PR11109 must appear at the end of the source file
 class pr11109r3 { // expected-note{{to match this '{'}}
   public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}}