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

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 05:46:27 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;
+    }
----------------
sdkrystian wrote:

@cor3ntin We diagnose namespace scope template/explicit specialization/explicit instantiation declarations with multiple declarators [in the parser as well](https://github.com/llvm/llvm-project/blob/c20811b659766469e80317702ee204ef6c4375b4/clang/lib/Parse/ParseTemplate.cpp#L370)... is there a reason not to?

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


More information about the cfe-commits mailing list