[clang] 0df4e63 - [OpenCL] update address-spaces.cl (#162785)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 9 22:56:41 PDT 2025


Author: Henrik G. Olsson
Date: 2025-10-10T05:56:37Z
New Revision: 0df4e63798d208d7e0fe1f4693046bbe7f7ca704

URL: https://github.com/llvm/llvm-project/commit/0df4e63798d208d7e0fe1f4693046bbe7f7ca704
DIFF: https://github.com/llvm/llvm-project/commit/0df4e63798d208d7e0fe1f4693046bbe7f7ca704.diff

LOG: [OpenCL] update address-spaces.cl (#162785)

This test was broken by
https://github.com/llvm/llvm-project/pull/162714. Previously the
`[[clang::opencl_private]]` attribute was applied first, resulting in
the clashing `__global` attribute being ignored. Now that `__global` is
applied first, it results in an error, and then
`[[clang::opencl_private]]` is applied, resulting in another error.

Added: 
    

Modified: 
    clang/test/SemaOpenCL/address-spaces.cl

Removed: 
    


################################################################################
diff  --git a/clang/test/SemaOpenCL/address-spaces.cl b/clang/test/SemaOpenCL/address-spaces.cl
index 86435b7b15b34..6c3ee899be617 100644
--- a/clang/test/SemaOpenCL/address-spaces.cl
+++ b/clang/test/SemaOpenCL/address-spaces.cl
@@ -265,7 +265,8 @@ void func_multiple_addr2(void) {
   __attribute__((opencl_private)) private_int_t var5;  // expected-warning {{multiple identical address spaces specified for type}}
   __attribute__((opencl_private)) private_int_t *var6; // expected-warning {{multiple identical address spaces specified for type}}
 #if __OPENCL_CPP_VERSION__
-  __global int [[clang::opencl_private]] var7;         // expected-error {{multiple address spaces specified for type}}
+  __global int [[clang::opencl_private]] var7;         // expected-error {{multiple address spaces specified for type}} \
+                                                       // expected-error {{function scope variable cannot be declared in global address space}}
   __global int [[clang::opencl_private]] *var8;        // expected-error {{multiple address spaces specified for type}}
   private_int_t [[clang::opencl_private]] var9;        // expected-warning {{multiple identical address spaces specified for type}}
   private_int_t [[clang::opencl_private]] *var10;      // expected-warning {{multiple identical address spaces specified for type}}


        


More information about the cfe-commits mailing list