[llvm-branch-commits] [clang] [Clang] [C++26] Expansion Statements (Part 2: Parsing and Parser Tests) (PR #169681)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 31 09:01:15 PDT 2026


================
@@ -2657,6 +2793,38 @@ StmtResult Parser::ParseCXXCatchBlock(bool FnCatch) {
   return Actions.ActOnCXXCatchBlock(CatchLoc, ExceptionDecl, Block.get());
 }
 
+StmtResult Parser::ParseExpansionStatement(SourceLocation *TrailingElseLoc,
+                                           LabelDecl *PrecedingLabel,
+                                           SourceLocation TemplateLoc) {
+  assert(Tok.is(tok::kw_for));
+  DiagCompat(TemplateLoc, diag_compat::expansion_statements);
----------------
Sirraide wrote:

Sort of: this _will_ print the 'expansion statements are incompatible with C++ standards before C++26’ if you have `-Wc++23-compat` or whatever that flag is called enabled; that’s irrespective of whether we backport the feature. I think it’s easiest to keep this as a compatibility diagnostic even if we don’t (currently) use the second diagnostic that this generates

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


More information about the llvm-branch-commits mailing list