]>
Commit | Line | Data |
---|---|---|
e79fc3d4 ESR |
1 | // { dg-do compile } |
2 | // { dg-options "-std=gnu++14 -pedantic" } | |
3 | ||
4 | template<typename T> | |
5 | struct is_float | |
6 | { | |
7 | static constexpr bool value = false; | |
8 | }; | |
9 | ||
10 | template<> | |
11 | struct is_float<float> | |
12 | { | |
13 | static constexpr bool value = true; | |
14 | }; | |
15 | ||
16 | template<typename T> | |
17 | T | |
18 | float_thing(T __x) | |
19 | { | |
20 | static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" } | |
21 | static_assert(is_float<T>::value); // { dg-error "static assertion failed" } | |
19520957 | 22 | return T(); |
e79fc3d4 ESR |
23 | } |
24 | ||
25 | int | |
26 | main() | |
27 | { | |
28 | float_thing(1); | |
29 | } | |
30 | ||
a9c697b8 | 31 | // { dg-warning "'static_assert' without a message only available with " "" { target *-*-* } 21 } |