================
@@ -491,6 +520,50 @@ __device__ void *ptr2 = ptr1;
 // expected-error@-1 {{dynamic initialization is not supported for __device__, 
__constant__, __shared__, and __managed__ variables}}
 
 __device__ [[gnu::constructor(101)]] void ctor() {}
-// expected-error@-1 {{CUDA does not support global constructors for 
__device__ functions}}
+// dev-error@-1 {{CUDA does not support global constructors for __device__ 
functions}}
 __device__ [[gnu::destructor(101)]] void dtor() {}
-// expected-error@-1 {{CUDA does not support global destructors for __device__ 
functions}}
+// dev-error@-1 {{CUDA does not support global destructors for __device__ 
functions}}
+
+__global__ void gf_local_static() {
+  static HD_NEC nec;
+  // expected-error@-1 {{dynamic initialization is not supported for 
__device__, __constant__, __shared__, and __managed__ variables}}
+  static HD_EC ec;
+  static int i = 42;
+}
+
+__host__ __device__ void hd_local_static() {
+  static HD_NEC nec;
+  // dev-error@-1 {{dynamic initialization is not supported for __device__, 
__constant__, __shared__, and __managed__ variables}}
+  static int i = 42;
+}
+
+inline __host__ __device__ void hd_local_static_host_only() {
+  static HD_NEC nec;
+  // dev-error@-1 {{dynamic initialization is not supported for __device__, 
__constant__, __shared__, and __managed__ variables}}
+}
+
+void call_hd_local_static_host_only() { hd_local_static_host_only(); }
+
+__host__ void h_local_static() { static HD_NEC nec; }
+void plain_local_static() { static HD_NEC nec; }
+
+#if __cplusplus >= 202002L
----------------
Sirraide wrote:

So we generally prefer not to disable/enable test code with preprocessor 
directives like this; instead of this, change the C++11 RUN lines to 
`-verify=expected,cxx11` and then add `cxx11-error` etc. comments for whatever 
diagnostics you get here in C++11 mode.

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