[OpenCL] Fixed test for the cast operators.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Tue, 28 Apr 2020 10:49:31 +0000 (11:49 +0100)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Tue, 28 Apr 2020 11:46:36 +0000 (12:46 +0100)
The test had unused variable because it missed to cover
case with __constant address space. This change now
completes the testing fully.

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

index d61a9a7..7fd7f72 100644 (file)
@@ -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}}
 }