comparison gcc/testsuite/g++.dg/cpp1z/static_assert-nomsg.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // { dg-options "-std=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 T
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 }