1 // REQUIRES: amdgpu-registered-target
2 // RUN: %clang_cc1 -fsyntax-only -verify -triple amdgcn -Wno-unused-value %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64 -aux-triple amdgcn -Wno-unused-value %s
5 #define __device__ __attribute__((device))
7 __device__ void foo() {
9 __amdgpu_buffer_rsrc_t v = 0; // expected-error {{cannot initialize a variable of type '__amdgpu_buffer_rsrc_t' with an rvalue of type 'int'}}
10 static_cast<__amdgpu_buffer_rsrc_t>(n); // expected-error {{static_cast from 'int' to '__amdgpu_buffer_rsrc_t' is not allowed}}
11 dynamic_cast<__amdgpu_buffer_rsrc_t>(n); // expected-error {{invalid target type '__amdgpu_buffer_rsrc_t' for dynamic_cast; target type must be a reference or pointer type to a defined class}}
12 reinterpret_cast<__amdgpu_buffer_rsrc_t>(n); // expected-error {{reinterpret_cast from 'int' to '__amdgpu_buffer_rsrc_t' is not allowed}}
13 int c(v); // expected-error {{cannot initialize a variable of type 'int' with an lvalue of type '__amdgpu_buffer_rsrc_t'}}
14 __amdgpu_buffer_rsrc_t k;
15 int *ip = (int *)k; // expected-error {{cannot cast from type '__amdgpu_buffer_rsrc_t' to pointer type 'int *'}}
16 void *vp = (void *)k; // expected-error {{cannot cast from type '__amdgpu_buffer_rsrc_t' to pointer type 'void *'}}
19 static_assert(sizeof(__amdgpu_buffer_rsrc_t) == 16, "wrong size");
20 static_assert(alignof(__amdgpu_buffer_rsrc_t) == 16, "wrong aignment");