[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:11:03 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)) {
----------------
Veeloxfire wrote:

In hindsight yes I think thats a better solution. I believe this solution came about because I was just going to check for `identifier` but then realised there were more options for type templates and kept adding

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


More information about the cfe-commits mailing list