================
@@ -764,8 +764,19 @@ void SemaCUDA::checkAllowedInitializer(VarDecl *VD) {
   if (VD->isInvalidDecl() || !VD->hasInit() || !VD->hasGlobalStorage() ||
       IsDependentVar(VD))
     return;
+
+  // A function-scope static is a device variable when it is emitted on the
+  // device side, and has the same initialization restrictions. Statics in
+  // implicit HD functions (such as lambdas) are host variables.
+  CUDAVariableTarget VT = IdentifyTarget(VD);
+  const auto *FD = dyn_cast_or_null<FunctionDecl>(VD->getDeclContext());
----------------
pjmc-oliveira wrote:

Hadn't `dyn_cast` was the way to go. Changed it now.

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

Reply via email to