================
@@ -19409,6 +19409,18 @@ static bool isVariableCapturable(CapturingScopeInfo 
*CSI, ValueDecl *Var,
   }
 
   if (isa<BindingDecl>(Var)) {
+    if (auto *RSI = dyn_cast<CapturedRegionScopeInfo>(CSI)) {
+      if (RSI->CapRegionKind == CR_OpenMP) {
+        if (Diagnose && S.getLangOpts().CPlusPlus) {
+          S.Diag(Loc, S.LangOpts.CPlusPlus20
+                          ? diag::warn_cxx17_compat_capture_binding
+                          : diag::ext_capture_binding)
+              << Var;
+          S.Diag(Var->getLocation(), diag::note_entity_declared_at) << Var;
+        }
----------------
alexey-bataev wrote:

Missing early rejection of tuple-like bindings. This causes two problems: (a) 
the extension warning fires for tuple-like bindings that will be rejected by an 
error, producing confusing diagnostics (warning says "extension" implying it 
works, error says "not supported"); (b) the variable is processed as capturable 
through multiple Sema layers before rejection, which is fragile. This was 
requested in a prior review (May 24) and marked "Done" but the code here has no 
tuple-like check. Add if (cast<BindingDecl>(Var)->getHoldingVar()) guard to 
return false for tuple-like bindings immediately.

https://github.com/llvm/llvm-project/pull/190832
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to