diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-07 00:48:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-07 00:48:47 +0000 |
commit | bd87c0bd2358498eae71c6cb24e57d2c884c74aa (patch) | |
tree | 669c4e5ff5b8409f31cebaf0900826b2fbee2c89 | |
parent | 721e77db41cd9a07d2e1c9fdf08a4bd2eee1bc98 (diff) |
fix a crash on invalid I found when working on something unrelated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90729 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/Parser.cpp | 4 | ||||
-rw-r--r-- | test/Parser/cxx-friend.cpp | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index ca425e8b05..20e5c589d7 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1030,7 +1030,9 @@ bool Parser::TryAnnotateCXXScopeToken(bool EnteringContext) { CXXScopeSpec SS; if (!ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, EnteringContext)) - return Tok.is(tok::annot_template_id); + // If the token left behind is not an identifier, we either had an error or + // successfully turned it into an annotation token. + return Tok.isNot(tok::identifier); // Push the current token back into the token stream (or revert it if it is // cached) and use an annotation scope token for current token. diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp index 14b31af761..6505ad0f6f 100644 --- a/test/Parser/cxx-friend.cpp +++ b/test/Parser/cxx-friend.cpp @@ -30,3 +30,11 @@ class B { void f(A *a) { a->f(); } }; + + + + +template <typename t1, typename t2> class some_template; +friend // expected-error {{'friend' used outside of class}} +some_template<foo, bar>& // expected-error {{use of undeclared identifier 'foo'}} + ; // expected-error {{expected unqualified-id}} |