diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-06-16 23:00:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-06-16 23:00:59 +0000 |
commit | d6ab232bb3ec9847de5af06249afb63078b5f2ee (patch) | |
tree | 1c68b10a04ef4a18ef458c426c4eafef231ae07f /lib/Parse/ParseTemplate.cpp | |
parent | 1a15dae8be2b28e02b6639aa92b832465c5be420 (diff) |
When we see a 'template' disambiguator that marks the next identifier
(or operator-function-id) as a template, but the context is actually
non-dependent or the current instantiation, allow us to use knowledge
of what kind of template it is, e.g., type template vs. function
template, for further syntactic disambiguation. This allows us to
parse properly in the presence of stray "template" keywords, which is
necessary in C++0x and it's good recovery in C++98/03.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseTemplate.cpp')
-rw-r--r-- | lib/Parse/ParseTemplate.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index ec0e31e703..9e95ca9f11 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -914,15 +914,14 @@ ParsedTemplateArgument Parser::ParseTemplateTemplateArgument() { // If the next token signals the end of a template argument, // then we have a dependent template name that could be a template // template argument. - if (isEndOfTemplateArgument(Tok)) { - TemplateTy Template - = Actions.ActOnDependentTemplateName(CurScope, TemplateLoc, SS, Name, - /*ObjectType=*/0, - /*EnteringContext=*/false); - if (Template.get()) - return ParsedTemplateArgument(SS, Template, Name.StartLocation); - } - } + TemplateTy Template; + if (isEndOfTemplateArgument(Tok) && + Actions.ActOnDependentTemplateName(CurScope, TemplateLoc, SS, Name, + /*ObjectType=*/0, + /*EnteringContext=*/false, + Template)) + return ParsedTemplateArgument(SS, Template, Name.StartLocation); + } } else if (Tok.is(tok::identifier)) { // We may have a (non-dependent) template name. TemplateTy Template; |