// RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -verify %s // RUN: %clang_cc1 -isystem %S/Inputs -fcuda-is-device -fsyntax-only -verify %s #include // Check trivial ctor/dtor struct A { int x; A() {} ~A() {} }; __device__ A a; // Check trivial ctor/dtor of template class template struct TA { T x; TA() {} ~TA() {} }; __device__ TA ta; // Check non-trivial ctor/dtor in parent template class template struct TB { T x; TB() { static int nontrivial_ctor = 1; } ~TB() {} }; template struct TC : TB { T x; TC() {} ~TC() {} }; template class TC; __device__ TC tc; //expected-error {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} // Check trivial ctor specialization template struct C { explicit C() {}; }; template <> C::C() {}; __device__ C ci_d; C ci_h; // Check non-trivial ctor specialization template <> C::C() { static int nontrivial_ctor = 1; } __device__ C cf_d; //expected-error {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} C cf_h;