diff options
author | Erich Keane <erich.keane@intel.com> | 2021-09-27 13:16:03 -0700 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2021-09-28 06:02:29 -0700 |
commit | 45e75d93821f7e4f04d9f42cb19f729b346e7c0c (patch) | |
tree | 95d4d9d55d39f5b3f558777e355251cefc57563b /clang/lib/Parse/ParseTemplate.cpp | |
parent | 7866dbb261240f71c79e70d2ed52351846f795cd (diff) | |
download | llvm-45e75d93821f7e4f04d9f42cb19f729b346e7c0c.zip llvm-45e75d93821f7e4f04d9f42cb19f729b346e7c0c.tar.gz llvm-45e75d93821f7e4f04d9f42cb19f729b346e7c0c.tar.bz2 |
Update the message for template-template param keyword for C++17
C++17 permits using 'typename' or 'class' for a template template
parameter, but the error message in the parser only refers to 'class'.
This patch, in C++17 or newer modes, adds "or 'template'" to the
diagnostic.
Diffstat (limited to 'clang/lib/Parse/ParseTemplate.cpp')
-rw-r--r-- | clang/lib/Parse/ParseTemplate.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp index 0fbde73..45af61a 100644 --- a/clang/lib/Parse/ParseTemplate.cpp +++ b/clang/lib/Parse/ParseTemplate.cpp @@ -906,10 +906,13 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) { } else if (Next.isOneOf(tok::identifier, tok::comma, tok::greater, tok::greatergreater, tok::ellipsis)) { Diag(Tok.getLocation(), diag::err_class_on_template_template_param) - << (Replace ? FixItHint::CreateReplacement(Tok.getLocation(), "class") - : FixItHint::CreateInsertion(Tok.getLocation(), "class ")); + << getLangOpts().CPlusPlus17 + << (Replace + ? FixItHint::CreateReplacement(Tok.getLocation(), "class") + : FixItHint::CreateInsertion(Tok.getLocation(), "class ")); } else - Diag(Tok.getLocation(), diag::err_class_on_template_template_param); + Diag(Tok.getLocation(), diag::err_class_on_template_template_param) + << getLangOpts().CPlusPlus17; if (Replace) ConsumeToken(); |