[cfe-commits] r90729 - in /cfe/trunk: lib/Parse/Parser.cpp test/Parser/cxx-friend.cpp
Chris Lattner
sabre at nondot.org
Sun Dec 6 16:48:47 PST 2009
Author: lattner
Date: Sun Dec 6 18:48:47 2009
New Revision: 90729
URL: http://llvm.org/viewvc/llvm-project?rev=90729&view=rev
Log:
fix a crash on invalid I found when working on something unrelated.
Modified:
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/test/Parser/cxx-friend.cpp
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=90729&r1=90728&r2=90729&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Sun Dec 6 18:48:47 2009
@@ -1030,7 +1030,9 @@
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.
Modified: cfe/trunk/test/Parser/cxx-friend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-friend.cpp?rev=90729&r1=90728&r2=90729&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-friend.cpp (original)
+++ cfe/trunk/test/Parser/cxx-friend.cpp Sun Dec 6 18:48:47 2009
@@ -30,3 +30,11 @@
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}}
More information about the cfe-commits
mailing list