aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-02-28 03:02:23 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-02-28 03:02:23 +0000
commit77a9c60aa670d262d9bc98fe327067a40c3c2afc (patch)
treef613992afcd3d40fb8756bcb0e00f0105e7b78d0 /clang/lib/Parse/ParseDecl.cpp
parentc1a40220b4f4983706a4509f0291bb8c2a24b8a1 (diff)
downloadllvm-77a9c60aa670d262d9bc98fe327067a40c3c2afc.zip
llvm-77a9c60aa670d262d9bc98fe327067a40c3c2afc.tar.gz
llvm-77a9c60aa670d262d9bc98fe327067a40c3c2afc.tar.bz2
Fix a couple of cases where we would fail to correctly parse deduced class template specialization types.
Specifically, we would not properly parse these types within template arguments (for non-type template parameters), and in tentative parses. Fixing both of these essentially requires that we parse deduced template specialization types as types in all contexts, even in template argument lists -- in particular, tentative parsing may look ahead and annotate a deduced template specialization type before we figure out that we're actually supposed to treat the tokens as a template-name. We deal with this by simply permitting deduced template specialization types when parsing template arguments, and converting them to template template arguments. llvm-svn: 326299
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 3a3096f..deefcaf 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -2686,7 +2686,8 @@ Parser::getDeclSpecContextFromDeclaratorContext(DeclaratorContext Context) {
return DeclSpecContext::DSC_top_level;
if (Context == DeclaratorContext::TemplateParamContext)
return DeclSpecContext::DSC_template_param;
- if (Context == DeclaratorContext::TemplateTypeArgContext)
+ if (Context == DeclaratorContext::TemplateArgContext ||
+ Context == DeclaratorContext::TemplateTypeArgContext)
return DeclSpecContext::DSC_template_type_arg;
if (Context == DeclaratorContext::TrailingReturnContext ||
Context == DeclaratorContext::TrailingReturnVarContext)
@@ -5637,7 +5638,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
// An identifier within parens is unlikely to be intended to be anything
// other than a name being "declared".
DiagnoseIdentifier = true;
- else if (D.getContext() == DeclaratorContext::TemplateTypeArgContext)
+ else if (D.getContext() == DeclaratorContext::TemplateArgContext)
// T<int N> is an accidental identifier; T<int N indicates a missing '>'.
DiagnoseIdentifier =
NextToken().isOneOf(tok::comma, tok::greater, tok::greatergreater);