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