[clang] fe667e8 - [OpenCL] Fixed test for the cast operators.

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 04:46:55 PDT 2020


Author: Anastasia Stulova
Date: 2020-04-28T12:46:36+01:00
New Revision: fe667e8522a6be5f73b2aed1adf4ec92d0470695

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

LOG: [OpenCL] Fixed test for the cast operators.

The test had unused variable because it missed to cover
case with __constant address space. This change now
completes the testing fully.

Added: 
    

Modified: 
    clang/test/SemaOpenCLCXX/address-space-castoperators.cl

Removed: 
    


################################################################################
diff  --git a/clang/test/SemaOpenCLCXX/address-space-castoperators.cl b/clang/test/SemaOpenCLCXX/address-space-castoperators.cl
index d61a9a72573c..7fd7f728fda3 100644
--- a/clang/test/SemaOpenCLCXX/address-space-castoperators.cl
+++ b/clang/test/SemaOpenCLCXX/address-space-castoperators.cl
@@ -9,4 +9,9 @@ void nester_ptr() {
   gengen = static_cast<int**>(locgen); //expected-error{{static_cast from '__local int *__generic *' to '__generic int *__generic *' is not allowed}}
 // CHECK-NOT: AddressSpaceConversion
   gengen = reinterpret_cast<int**>(locgen); //expected-warning{{reinterpret_cast from '__local int *__generic *' to '__generic int *__generic *' changes address space of nested pointers}}
+
+  gengen = const_cast<int**>(congen); //expected-error{{const_cast from '__constant int *__generic *' to '__generic int *__generic *' is not allowed}}
+  gengen = static_cast<int**>(congen); //expected-error{{static_cast from '__constant int *__generic *' to '__generic int *__generic *' is not allowed}}
+// CHECK-NOT: AddressSpaceConversion
+  gengen = reinterpret_cast<int**>(congen); //expected-warning{{reinterpret_cast from '__constant int *__generic *' to '__generic int *__generic *' changes address space of nested pointers}}
 }


        


More information about the cfe-commits mailing list