[clang] [Clang][C2y] Add support for if declarations (N3356 paper) (PR #198244)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Mon May 18 08:10:24 PDT 2026


================
@@ -2162,10 +2162,11 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
   ParsedAttributes LocalAttrs(AttrFactory);
   LocalAttrs.takeAllPrependingFrom(Attrs);
   ParsingDeclarator D(*this, DS, LocalAttrs, Context);
-  if (TemplateInfo.TemplateParams)
+  if (!getLangOpts().C2y && TemplateInfo.TemplateParams)
     D.setTemplateParameterLists(*TemplateInfo.TemplateParams);
----------------
cor3ntin wrote:

This can never be true. did you try `assert(!getLangOpts().C)` instead?

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


More information about the cfe-commits mailing list