1 // CUDA struct types with interesting initialization properties.
2 // Keep in sync with ../SemaCUDA/Inputs/cuda-initializers.h.
4 // Base classes with different initializer variants.
6 // trivial constructor -- allowed
14 __device__
EC() {} // -- allowed
15 __device__
EC(int) {} // -- not allowed
20 __device__
~ED() {} // -- allowed
24 __device__
ECD() {} // -- allowed
25 __device__
~ECD() {} // -- allowed
28 // empty templated constructor -- allowed with no arguments
30 template <typename
... T
> __device__
ETC(T
...) {}
33 // undefined constructor -- not allowed
39 // undefined destructor -- not allowed
45 // empty constructor w/ initializer list -- not allowed
48 __device__
ECI() : eci(1) {}
51 // non-empty constructor -- not allowed
54 __device__
NEC() { nec
= 1; }
57 // non-empty destructor -- not allowed
60 __device__
~NED() { ned
= 1; }
63 // no-constructor, virtual method -- not allowed
66 __device__
virtual void vm() {}
69 // virtual destructor -- not allowed.
71 __device__
virtual ~VD() {}
74 // dynamic in-class field initializer -- not allowed
80 // static in-class field initializer. NVCC does not allow it, but
81 // clang generates static initializer for this, so we'll accept it.
82 // We still can't use it on __shared__ vars as they don't allow *any*
88 // undefined templated constructor -- not allowed
90 template <typename
... T
> __device__
UTC(T
...);
93 // non-empty templated constructor -- not allowed
96 template <typename
... T
> __device__
NETC(T
...) { netc
= 1; }
99 // Regular base class -- allowed
102 // Incapsulated object of allowed class -- allowed
107 // array of allowed objects -- allowed
113 // Calling empty base class initializer is OK
114 struct EC_I_EC
: EC
{
115 __device__
EC_I_EC() : EC() {}
118 // .. though passing arguments is not allowed.
119 struct EC_I_EC1
: EC
{
120 __device__
EC_I_EC1() : EC(1) {}
123 // Virtual base class -- not allowed
124 struct T_V_T
: virtual T
{};
126 // Inherited from or incapsulated class with non-empty constructor --
128 struct T_B_NEC
: NEC
{};
137 // Inherited from or incapsulated class with non-empty desstructor --
139 struct T_B_NED
: NED
{};