brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · f0ec86c Raw
18 lines · plain
1//RUN: %clang_cc1 %s -pedantic -ast-dump -verify | FileCheck %s2 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: AddressSpaceConversion11  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: AddressSpaceConversion16  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