]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/std/concepts/concepts.lang/concept.arithmetic/floating_point.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / std / concepts / concepts.lang / concept.arithmetic / floating_point.cc
1 // Copyright (C) 2019-2022 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 // { dg-options "-std=gnu++2a" }
19 // { dg-do compile { target c++2a } }
20
21 #include <concepts>
22
23 static_assert( std::floating_point<float> );
24 static_assert( std::floating_point<double> );
25 static_assert( std::floating_point<long double> );
26 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
27 static_assert( std::floating_point<__float128> );
28 #endif
29
30 static_assert( !std::floating_point<char> );
31 static_assert( !std::floating_point<signed char> );
32 static_assert( !std::floating_point<bool> );
33 static_assert( !std::floating_point<int> );
34 static_assert( !std::floating_point<char32_t> );
35
36 #ifdef __GLIBCXX_TYPE_INT_N_0
37 static_assert( !std::floating_point<signed __GLIBCXX_TYPE_INT_N_0> );
38 #endif
39
40 static_assert( !std::floating_point<void> );
41 static_assert( !std::floating_point<float*> );
42 static_assert( !std::floating_point<float&> );
43 static_assert( !std::floating_point<float&&> );
44 static_assert( !std::floating_point<const float&> );
45 static_assert( !std::floating_point<float[]> );
46 static_assert( !std::floating_point<float[2]> );
47 static_assert( !std::floating_point<float()> );
48 static_assert( !std::floating_point<float(*)()> );
49 static_assert( !std::floating_point<float(&)()> );
50
51 enum E { };
52 static_assert( !std::floating_point<E> );
53 enum class CE { };
54 static_assert( !std::floating_point<CE> );
55 struct A { };
56 static_assert( !std::floating_point<A> );
57 union B { };
58 static_assert( !std::floating_point<B> );