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

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 5 06:57:07 PDT 2026


================
@@ -19493,16 +19505,19 @@ static bool captureInCapturedRegion(
   if (IsTopScope && Kind != TryCaptureKind::Implicit) {
     ByRef = (Kind == TryCaptureKind::ExplicitByRef);
   } else if (S.getLangOpts().OpenMP && RSI->CapRegionKind == CR_OpenMP) {
+    bool IsBindingDecl = isa<BindingDecl>(Var);
     // Using an LValue reference type is consistent with Lambdas (see below).
-    if (S.OpenMP().isOpenMPCapturedDecl(Var)) {
+    if (VarDecl *VD = S.OpenMP().isOpenMPCapturedDecl(Var)) {
+      Var = VD; // Capture the DecompositionDecl.
----------------
zahiraam wrote:

It should remain the `BindingDecl`'s type (`int`), not the the `DecompositionDecl`'s type (`Point`).

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


More information about the cfe-commits mailing list