summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-06-16 23:00:59 +0000
committerDouglas Gregor <dgregor@apple.com>2010-06-16 23:00:59 +0000
commitbb1196534c9bd929afeb17643b3b86401d636b39 (patch)
tree0160482e2a8339aa7a42274335dfcac29febf89c /clang/lib/Parse/ParseTemplate.cpp
parente94f1ded24ae8f25bdbb318264a15afa8abd23eb (diff)
downloadbcm5719-llvm-bb1196534c9bd929afeb17643b3b86401d636b39.tar.gz
bcm5719-llvm-bb1196534c9bd929afeb17643b3b86401d636b39.zip
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. llvm-svn: 106167
Diffstat (limited to 'clang/lib/Parse/ParseTemplate.cpp')
-rw-r--r--clang/lib/Parse/ParseTemplate.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp
index ec0e31e703c..9e95ca9f11f 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud