]> granicus.if.org Git - clang/commitdiff
Fix crash-on-invalid: don't look ahead past an unknown token, it might be EOF.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 21 Jul 2015 00:23:34 +0000 (00:23 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 21 Jul 2015 00:23:34 +0000 (00:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242744 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp
test/Parser/cxx0x-decl.cpp

index 0fb1de94e8ead0b8503330558b5d9c883ca66f32..79138900b83bf7d2e8700680e2688cef69adbf72 100644 (file)
@@ -546,7 +546,8 @@ Decl *Parser::ParseUsingDeclaration(unsigned Context,
   } else if (ParseUnqualifiedId(
                  SS, /*EnteringContext=*/false,
                  /*AllowDestructorName=*/true,
-                 /*AllowConstructorName=*/NextToken().isNot(tok::equal),
+                 /*AllowConstructorName=*/!(Tok.is(tok::identifier) &&
+                                            NextToken().is(tok::equal)),
                  ParsedType(), TemplateKWLoc, Name)) {
     SkipUntil(tok::semi);
     return nullptr;
index 994104fc9dfbb1601ff23e680651a43ae73063bf..23f46a1847888fba3a90f217a846a6359f463cd8 100644 (file)
@@ -132,3 +132,7 @@ void NoMissingSemicolonHere(struct S
                             [3]);
 template<int ...N> void NoMissingSemicolonHereEither(struct S
                                                      ... [N]);
+
+// This must be at the end of the file; we used to look ahead past the EOF token here.
+// expected-error@+1 {{expected unqualified-id}}
+using