[clang] [OpenMP] Support capturing structured bindings in OpenMP regions. (PR #190832)

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 17 06:58:23 PDT 2026


================
@@ -1575,6 +1652,48 @@ void CodeGenFunction::EmitOMPReductionClauseInit(
   auto *IPriv = Privates.begin();
   for (const Expr *IRef : Shareds) {
     const auto *PrivateVD = cast<VarDecl>(cast<DeclRefExpr>(*IPriv)->getDecl());
+    const BindingDecl *BD = nullptr;
----------------
zahiraam wrote:

I chose to add explicit diagnostics rather than extend `ReductionCodeGen` infrastructure. The diagnostics are in Sema (`actOnOMPReductionKindClause` in `SemaOpenMP.cpp` around line 20693) .
Non-trivially-destructible types: Tested and confirmed working correctly.  Added test coverage in `structured-bindings-codegen.cpp` (`test_reduction_binding_nontrivial`).

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


More information about the cfe-commits mailing list