[clang] [Clang] [C++26] Expansion Statements (Part 1: AST) (PR #169680)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 15:51:55 PDT 2026


================
@@ -3343,6 +3343,127 @@ class TemplateParamObjectDecl : public ValueDecl,
   static bool classofKind(Kind K) { return K == TemplateParamObject; }
 };
 
+/// Represents a C++26 expansion statement declaration.
+///
+/// This is a bit of a hack, since expansion statements shouldn't really be
+/// 'declarations' per se (they don't declare anything). Nevertheless, we *do*
+/// need them to be declaration *contexts*, because the DeclContext is used to
+/// compute the 'template depth' of entities enclosed therein. In particular,
+/// the 'template depth' is used to find instantiations of parameter variables,
+/// and a lambda enclosed within an expansion statement cannot compute its
----------------
shafik wrote:

```suggestion
/// the 'template depth' is used to find instantiations of parameter variables.
/// A lambda enclosed within an expansion statement cannot compute its
```

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


More information about the cfe-commits mailing list