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
73 lines
2.3 KiB
Plaintext
73 lines
2.3 KiB
Plaintext
// RUN: %clang_cc1 -fsyntax-only -verify=host,expected %s
|
|
// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify=dev,expected %s
|
|
|
|
#include "Inputs/cuda.h"
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 1: host method called from device function
|
|
|
|
struct S1 {
|
|
void method() {} // dev-note {{'method' declared here}}
|
|
};
|
|
|
|
__device__ void foo1(S1& s) {
|
|
s.method(); // dev-error {{reference to __host__ function 'method' in __device__ function}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 2: host method called from device function, for overloaded method
|
|
|
|
struct S2 {
|
|
void method(int) {} // expected-note {{candidate function not viable: call to __host__ function from __device__ function}}
|
|
void method(float) {} // expected-note {{candidate function not viable: call to __host__ function from __device__ function}}
|
|
};
|
|
|
|
__device__ void foo2(S2& s, int i, float f) {
|
|
s.method(f); // expected-error {{no matching member function}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 3: device method called from host function
|
|
|
|
struct S3 {
|
|
__device__ void method() {} // host-note {{'method' declared here}}
|
|
};
|
|
|
|
void foo3(S3& s) {
|
|
s.method(); // host-error {{reference to __device__ function 'method' in __host__ function}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 4: device method called from host&device function
|
|
|
|
struct S4 {
|
|
__device__ void method() {} // host-note {{'method' declared here}}
|
|
};
|
|
|
|
__host__ __device__ void foo4(S4& s) {
|
|
s.method(); // host-error {{reference to __device__ function 'method' in __host__ __device__ function}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 5: overloaded operators
|
|
|
|
struct S5 {
|
|
S5() {}
|
|
S5& operator=(const S5&) {return *this;} // expected-note {{candidate function not viable}}
|
|
};
|
|
|
|
__device__ void foo5(S5& s, S5& t) {
|
|
s = t; // expected-error {{no viable overloaded '='}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 6: call method through pointer
|
|
|
|
struct S6 {
|
|
void method() {} // dev-note {{'method' declared here}};
|
|
};
|
|
|
|
__device__ void foo6(S6* s) {
|
|
s->method(); // dev-error {{reference to __host__ function 'method' in __device__ function}}
|
|
}
|