[clang] [Clang][Parse] Diagnose member template declarations with multiple declarators (PR #78243)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 05:02:43 PST 2024


================
@@ -3167,6 +3167,15 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
 
     DeclaratorInfo.complete(ThisDecl);
 
+    if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate) {
+      if (Tok.is(tok::comma)) {
+        Diag(Tok, diag::err_multiple_template_declarators)
+            << (int)TemplateInfo.Kind;
+        SkipUntil(tok::semi, StopBeforeMatch);
+      }
+      break;
+    }
----------------
cor3ntin wrote:

I am not sure it make sense to do that in the parser.
Can we maybe to that in `FinalizeDeclaratorGroup`?
At that point we should have fully formed `Decl`s and we can check whether they are templates

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


More information about the cfe-commits mailing list