[clang] [Clang][AMDGPU] Add a new builtin type for buffer rsrc (PR #94830)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 10 08:40:34 PDT 2024
================
@@ -0,0 +1,11 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -fsyntax-only -verify -triple amdgcn -Wno-unused-value %s
+
+void foo() {
+ int n = 100;
+ __buffer_rsrc_t v = 0; // expected-error {{cannot initialize a variable of type '__buffer_rsrc_t' with an rvalue of type 'int'}}
+ static_cast<__buffer_rsrc_t>(n); // expected-error {{static_cast from 'int' to '__buffer_rsrc_t' is not allowed}}
+ dynamic_cast<__buffer_rsrc_t>(n); // expected-error {{invalid target type '__buffer_rsrc_t' for dynamic_cast; target type must be a reference or pointer type to a defined class}}
+ reinterpret_cast<__buffer_rsrc_t>(n); // expected-error {{reinterpret_cast from 'int' to '__buffer_rsrc_t' is not allowed}}
+ int c(v); // expected-error {{cannot initialize a variable of type 'int' with an lvalue of type '__buffer_rsrc_t'}}
+}
----------------
arsenm wrote:
Also test some c style casts to other pointer types
https://github.com/llvm/llvm-project/pull/94830
More information about the cfe-commits
mailing list