================
@@ -774,7 +774,7 @@ void SemaCUDA::checkAllowedInitializer(VarDecl *VD) {
          IsSharedVar ? diag::err_shared_var_init : diag::err_dynamic_var_init)
         << Init->getSourceRange();
     VD->setInvalidDecl();
-  } else {
+  } else if (IdentifyTarget(VD) == CVT_Host) {
----------------
Fznamznon wrote:

Thank you, good catch. I preserved the check and added a test.
I also added some tests for template contexts, but it seems a missing error 
there is preexisting problem and not a regression of the patch 
https://godbolt.org/z/MbGn95Ydn 

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

Reply via email to