Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

146 lines
2.7 KiB
C++

// CUDA struct types with interesting initialization properties.
// Keep in sync with ../SemaCUDA/Inputs/cuda-initializers.h.
// Base classes with different initializer variants.
// trivial constructor -- allowed
struct T {
int t;
};
// empty constructor
struct EC {
int ec;
__device__ EC() {} // -- allowed
__device__ EC(int) {} // -- not allowed
};
// empty destructor
struct ED {
__device__ ~ED() {} // -- allowed
};
struct ECD {
__device__ ECD() {} // -- allowed
__device__ ~ECD() {} // -- allowed
};
// empty templated constructor -- allowed with no arguments
struct ETC {
template <typename... T> __device__ ETC(T...) {}
};
// undefined constructor -- not allowed
struct UC {
int uc;
__device__ UC();
};
// undefined destructor -- not allowed
struct UD {
int ud;
__device__ ~UD();
};
// empty constructor w/ initializer list -- not allowed
struct ECI {
int eci;
__device__ ECI() : eci(1) {}
};
// non-empty constructor -- not allowed
struct NEC {
int nec;
__device__ NEC() { nec = 1; }
};
// non-empty destructor -- not allowed
struct NED {
int ned;
__device__ ~NED() { ned = 1; }
};
// no-constructor, virtual method -- not allowed
struct NCV {
int ncv;
__device__ virtual void vm() {}
};
// virtual destructor -- not allowed.
struct VD {
__device__ virtual ~VD() {}
};
// dynamic in-class field initializer -- not allowed
__device__ int f();
struct NCF {
int ncf = f();
};
// static in-class field initializer. NVCC does not allow it, but
// clang generates static initializer for this, so we'll accept it.
// We still can't use it on __shared__ vars as they don't allow *any*
// initializers.
struct NCFS {
int ncfs = 3;
};
// undefined templated constructor -- not allowed
struct UTC {
template <typename... T> __device__ UTC(T...);
};
// non-empty templated constructor -- not allowed
struct NETC {
int netc;
template <typename... T> __device__ NETC(T...) { netc = 1; }
};
// Regular base class -- allowed
struct T_B_T : T {};
// Incapsulated object of allowed class -- allowed
struct T_F_T {
T t;
};
// array of allowed objects -- allowed
struct T_FA_T {
T t[2];
};
// Calling empty base class initializer is OK
struct EC_I_EC : EC {
__device__ EC_I_EC() : EC() {}
};
// .. though passing arguments is not allowed.
struct EC_I_EC1 : EC {
__device__ EC_I_EC1() : EC(1) {}
};
// Virtual base class -- not allowed
struct T_V_T : virtual T {};
// Inherited from or incapsulated class with non-empty constructor --
// not allowed
struct T_B_NEC : NEC {};
struct T_F_NEC {
NEC nec;
};
struct T_FA_NEC {
NEC nec[2];
};
// Inherited from or incapsulated class with non-empty desstructor --
// not allowed
struct T_B_NED : NED {};
struct T_F_NED {
NED ned;
};
struct T_FA_NED {
NED ned[2];
};