[clang] [Clang] [C++26] Implement P1306R5 Expansion Statements (PR #165195)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 1 12:35:44 PDT 2025


================
@@ -177,6 +185,11 @@ def CoyieldExpr : StmtNode<CoroutineSuspendExpr>;
 def ConceptSpecializationExpr : StmtNode<Expr>;
 def RequiresExpr : StmtNode<Expr>;
 
+// C++26 Expansion statement support expressions
+def CXXExpansionInitListExpr : StmtNode<Expr>;
+def CXXExpansionInitListSelectExpr : StmtNode<Expr>;
+def CXXDestructuringExpansionSelectExpr : StmtNode<Expr>;
----------------
cor3ntin wrote:

We are introducing a lot of nodes that are very similar.
Did you consider: merging the `SelectExpr` nodes - to the extent we need these, the index is implicit from the expansion order. And these things are always expanded, when they are created, when do we need an index?

For the initializer, can we maybe use a template argument, or a super set thereof?
I feel a lot of complexity of this PR comes from the very impressive number of new nodes


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


More information about the cfe-commits mailing list