[clang] [clang][Parser] "Better" error messages for invalid template template (PR #95726)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 17 03:06:11 PDT 2024
================
@@ -787,6 +787,23 @@ NamedDecl *Parser::ParseTemplateTemplateParameter(unsigned Depth,
unsigned Position) {
assert(Tok.is(tok::kw_template) && "Expected 'template' keyword");
+ if (Token ahead = GetLookAheadToken(1);
+ ahead.isOneOf(tok::identifier, tok::ellipsis,
+ tok::equal, tok::comma,
+ tok::greater, tok::greatergreater, tok::greatergreatergreater)) {
----------------
Sirraide wrote:
I think it might be simpler to just check if the next token is *not* `<` and correct to `typename` in that case since a template-template parameter always has to start with `template <` anyway.
https://github.com/llvm/llvm-project/pull/95726
More information about the cfe-commits
mailing list