1 // RUN: %clang_cc1 %s --std=c++11 -triple x86_64-linux-unknown -fsyntax-only -o - -verify
3 #include "Inputs/cuda.h"
7 __device__ A() { a = 1; }
8 __device__ ~A() { a = 2; }
11 // This can be a global var since ctor/dtors of data members are not called.
18 // This cannot be a global var since it has a dynamic ctor.
21 __device__ C() { a.a = 3; }
25 // This cannot be a global var since it has a dynamic dtor.
29 __device__ ~D() { a.a = 4; }
34 // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}}
36 // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}}
38 __device__ void foo() {
41 // expected-error@-1 {{initialization is not supported for __shared__ variables}}
43 // expected-error@-1 {{initialization is not supported for __shared__ variables}}