Files
TheRock/compiler/amd-llvm/clang/test/SemaOpenCLCXX/addrspace-constructors.clcpp
T
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

59 lines
1.9 KiB
Plaintext

// RUN: %clang_cc1 %s -pedantic -ast-dump -verify | FileCheck %s
__constant int g1; // expected-error {{variable in constant address space must be initialized}}
__constant int g2 = 0;
struct X {
int x;
//CHECK: CXXConstructorDecl
//CHECK-NOT: used
//CHECK-SAME: X 'void (){{.*}} __generic'
X() /*__generic*/ : x(0) {}
//CHECK: CXXConstructorDecl {{.*}} used X 'void (){{.*}} __private'
X() __private : x(0) {}
//CHECK: CXXConstructorDecl {{.*}} used X 'void (){{.*}} __global'
X() __global : x(0) {}
constexpr X() __constant : x(0) {}
constexpr X(int x) __constant : x(x) {}
};
__global X gx;
//expected-note@+2{{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const __generic Y' for 1st argument}}
//expected-note@+1{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to '__generic Y' for 1st argument}}
struct Y {
int y;
Y() __generic = default; // expected-note{{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
};
kernel void k() {
__constant X cx1;
__constant X cx2(1);
__local X lx;
__private X x;
__private X tx = X();
__private Y py;
__constant Y cy1; // expected-error{{variable in constant address space must be initialized}}
__constant Y cy2(1); // expected-error{{no matching constructor for initialization of '__constant Y'}}
}
struct Z {
int z;
// The address space is deduced to be __generic if omitted
Z() = default; // expected-note{{previous definition is here}}
Z() __generic = default; // expected-error {{constructor cannot be redeclared}}
Z() __private = default;
Z() __local = default;
Z() __global = default;
// Can't default constexpr constructors
constexpr Z() __constant : z(0) {}
};
struct W {
int w;
constexpr W() __constant = default; // expected-error {{defaulted definition of default constructor cannot be marked constexpr}}
};