[clang] [clang][Parser] "Better" error messages for invalid template template (PR #95726)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 04:53:59 PDT 2024


================
@@ -787,6 +787,20 @@ NamedDecl *Parser::ParseTemplateTemplateParameter(unsigned Depth,
                                                   unsigned Position) {
   assert(Tok.is(tok::kw_template) && "Expected 'template' keyword");
 
+  if (Token ahead = GetLookAheadToken(1); ahead.isNot(tok::less)) {
----------------
Veeloxfire wrote:

Actually this prompted me to check and I was just writing `NextToken()` manually (didnt realise `GetLookAheadToken` did a `-1`), so I think I'll switch it to `NextToken()` instead.
Then the renaming makes sense too with `Token Next = NextToken();`

https://github.com/llvm/llvm-project/pull/95726


More information about the cfe-commits mailing list