| 1 |
// Test for static_cast. |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
|
| 4 |
void f() |
| 5 |
{ |
| 6 |
typedef void (*P)(); |
| 7 |
typedef void (*NP)() noexcept; |
| 8 |
|
| 9 |
P p; |
| 10 |
NP np; |
| 11 |
|
| 12 |
static_cast<P>(np); |
| 13 |
static_cast<NP>(p); // { dg-error "3:invalid .static_cast." } |
| 14 |
} |