| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
constexpr int&& r = 1 + 2; // { dg-message "pointed-to object declared here" "" { target c++26 } } |
| 4 |
constexpr void* vpr = &r; |
| 5 |
constexpr int* pi = static_cast<int*>(vpr); // { dg-error "cast from .void\\*. is not allowed" "" { target c++23_down } } |
| 6 |
constexpr float* pf = static_cast<float*>(vpr); // { dg-error "cast from .void\\*. is not allowed" "" { target c++23_down } } |
| 7 |
// { dg-error "cast from .void\\*. is not allowed in a constant expression because pointed-to type .int. is not similar to .float." "" { target c++26 } .-1 } |
| 8 |
|
| 9 |
constexpr void* vnp = nullptr; |
| 10 |
constexpr int* pi2 = static_cast<int*>(vnp); // { dg-error "cast from .void\\*. is not allowed" "" { target c++23_down } } |