diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-21 23:43:39 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-21 23:43:39 +0000 |
commit | 20c38a7c5870d300a4d713c13ac5e761d61d04d7 (patch) | |
tree | 8dbe947280a848c69a762ab51387ceb3c59e0b76 /clang/lib/Parse/ParseTemplate.cpp | |
parent | 53ff992dde7d169ab1334264d2c542478d6b3706 (diff) | |
download | bcm5719-llvm-20c38a7c5870d300a4d713c13ac5e761d61d04d7.tar.gz bcm5719-llvm-20c38a7c5870d300a4d713c13ac5e761d61d04d7.zip |
Improve recovery when we see a dependent template name that is missing
the required "template" keyword, using the same heuristics we do for
dependent template names in member access expressions, e.g.,
test/SemaTemplate/dependent-template-recover.cpp:11:8: error: use 'template'
keyword to treat 'getAs' as a dependent template name
T::getAs<U>();
^
template
Fixes PR5404.
llvm-svn: 104409
Diffstat (limited to 'clang/lib/Parse/ParseTemplate.cpp')
-rw-r--r-- | clang/lib/Parse/ParseTemplate.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp index 8b9142ce9bd..c87ddad4e9b 100644 --- a/clang/lib/Parse/ParseTemplate.cpp +++ b/clang/lib/Parse/ParseTemplate.cpp @@ -971,12 +971,17 @@ ParsedTemplateArgument Parser::ParseTemplateArgument() { /// \brief Determine whether the current tokens can only be parsed as a /// template argument list (starting with the '<') and never as a '<' /// expression. -bool Parser::IsTemplateArgumentList() { +bool Parser::IsTemplateArgumentList(unsigned Skip) { struct AlwaysRevertAction : TentativeParsingAction { AlwaysRevertAction(Parser &P) : TentativeParsingAction(P) { } ~AlwaysRevertAction() { Revert(); } } Tentative(*this); + while (Skip) { + ConsumeToken(); + --Skip; + } + // '<' if (!Tok.is(tok::less)) return false; |