[clang] [Clang] Fix a number of issues involving expansion statements (PR #217110)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 04:09:08 PDT 2026


================
@@ -2262,15 +2261,34 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S,
     //   - null statements,
     return true;
 
-  case Stmt::DeclStmtClass:
+  case Stmt::DeclStmtClass: {
+    auto *DS = cast<DeclStmt>(S);
+
+    // Expansion statement 'declarations' have substatements, so we need to
+    // handle them separately.
+    if (DS->isSingleDecl()) {
----------------
cor3ntin wrote:

nit: you could return early there, to limit the nesting

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


More information about the cfe-commits mailing list