[clang] [OpenMP] Support capturing structured bindings in OpenMP regions. (PR #190832)
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 16 06:14:40 PDT 2026
================
@@ -1863,7 +1990,8 @@ checkForLastprivateConditionalUpdate(CodeGenFunction &CGF,
const auto *DRE = dyn_cast<DeclRefExpr>(Ref->IgnoreParenImpCasts());
if (!DRE)
continue;
- PrivateDecls.insert(cast<VarDecl>(DRE->getDecl()));
+ if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
+ PrivateDecls.insert(VD);
CGF.CGM.getOpenMPRuntime().checkAndEmitLastprivateConditional(CGF, Ref);
}
}
----------------
alexey-bataev wrote:
When DRE->getDecl() is a BindingDecl, the VD branch is skipped (correctly), but checkAndEmitLastprivateConditional still executes with a DeclRefExpr pointing to a BindingDecl. The runtime helper likely expects a VarDecl. Guard the call the same way you guarded the first linear block at ~line 1960-1975 (wrap both insert and conditional-check in the if (VD) block).
https://github.com/llvm/llvm-project/pull/190832
More information about the cfe-commits
mailing list