xref: /llvm-project/clang/test/SemaOpenCLCXX/address-space-castoperators.clcpp (revision d1c8a151df830c6c727f0bb7d33774bd3eb96824)
1//RUN: %clang_cc1 %s -pedantic -ast-dump -verify | FileCheck %s
2
3void nester_ptr() {
4  local int * * locgen;
5  constant int * * congen;
6  int * * gengen;
7
8  gengen = const_cast<int**>(locgen); //expected-error{{const_cast from '__local int *__generic *' to '__generic int *__generic *' is not allowed}}
9  gengen = static_cast<int**>(locgen); //expected-error{{static_cast from '__local int *__generic *' to '__generic int *__generic *' is not allowed}}
10// CHECK-NOT: AddressSpaceConversion
11  gengen = reinterpret_cast<int**>(locgen); //expected-warning{{reinterpret_cast from '__local int *__generic *' to '__generic int *__generic *' changes address space of nested pointers}}
12
13  gengen = const_cast<int**>(congen); //expected-error{{const_cast from '__constant int *__generic *' to '__generic int *__generic *' is not allowed}}
14  gengen = static_cast<int**>(congen); //expected-error{{static_cast from '__constant int *__generic *' to '__generic int *__generic *' is not allowed}}
15// CHECK-NOT: AddressSpaceConversion
16  gengen = reinterpret_cast<int**>(congen); //expected-warning{{reinterpret_cast from '__constant int *__generic *' to '__generic int *__generic *' changes address space of nested pointers}}
17}
18