1 // DR 1312 - Simulated reinterpret_cast in constant expressions.
3 // { dg-do compile { target c++11 } }
6 constexpr void *vp0 = nullptr;
7 constexpr void *vpi = &i;
8 constexpr int *p1 = (int *) vp0; // { dg-error "cast from .void\\*. is not allowed" "" { target c++23_down } }
9 constexpr int *p2 = (int *) vpi; // { dg-error "cast from .void\\*. is not allowed" "" { target c++23_down } }
10 constexpr int *p3 = static_cast<int *>(vp0); // { dg-error "cast from .void\\*. is not allowed" "" { target c++23_down } }
11 constexpr int *p4 = static_cast<int *>(vpi); // { dg-error "cast from .void\\*. is not allowed" "" { target c++23_down } }
12 constexpr void *p5 = vp0;
13 constexpr void *p6 = vpi;
15 constexpr int *pi = &i;
16 constexpr bool b = ((int *)(void *) pi == pi); // { dg-error "cast from .void\\*. is not allowed" "" { target c++23_down } }