================
@@ -429,16 +432,42 @@ __device__ void df_sema() {
   // expected-error@-1 {{initialization is not supported for __shared__ 
variables}}
   static __constant__ T_FA_NED c_t_fa_ned;
   // expected-error@-1 {{dynamic initialization is not supported for 
__device__, __constant__, __shared__, and __managed__ variables}}
+
+  static T l_t;
+  static EC l_ec;
+  static ECD l_ecd;
+  static EC_I_EC l_ec_i_ec;
+  static CEEC l_ceec;
+  static CGTC l_cgtc;
+  static NCFS l_ncfs;
+
+  static EC l_ec_i(3);
+  // expected-error@-1 {{dynamic initialization is not supported for 
__device__, __constant__, __shared__, and __managed__ variables}}
----------------
Sirraide wrote:

Now that I look at this again, this diagnostic needs to change because this 
function isn’t declared `__device__`, `__constant__`, `__shared__`, or 
`__managed__`.

In an earlier comment I recommended using `DiagIfDeviceCode()` for unannotated 
statics instead, so we might as well introduce a new diagnostic for this case 
(something like ‘'static' local variable requires runtime initialization or 
destruction, which is not supported in device code’; there’s probably a shorter 
way to express this though)

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