| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
|
| 3 |
template<typename T> |
| 4 |
struct is_float |
| 5 |
{ |
| 6 |
static constexpr bool value = false; |
| 7 |
}; |
| 8 |
|
| 9 |
template<> |
| 10 |
struct is_float<float> |
| 11 |
{ |
| 12 |
static constexpr bool value = true; |
| 13 |
}; |
| 14 |
|
| 15 |
template<typename T> |
| 16 |
void |
| 17 |
float_thing(T __x) |
| 18 |
{ |
| 19 |
static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" } |
| 20 |
static_assert(is_float<T>::value); // { dg-error "static assertion failed" } |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
main() |
| 25 |
{ |
| 26 |
float_thing(1); |
| 27 |
} |