Debian Codegraph @

libstdc++-v3/testsuite/std/concepts/concepts.lang/concept.arithmetic/floating_point.cc

raw
1 // Copyright (C) 2019-2025 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-do compile { target c++20 } }
19
20 #include <concepts>
21
22 static_assert( std::floating_point<float> );
23 static_assert( std::floating_point<double> );
24 static_assert( std::floating_point<long double> );
25 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
26 static_assert( std::floating_point<__float128> );
27 #endif
28
29 static_assert( !std::floating_point<char> );
30 static_assert( !std::floating_point<signed char> );
31 static_assert( !std::floating_point<bool> );
32 static_assert( !std::floating_point<int> );
33 static_assert( !std::floating_point<char32_t> );
34
35 #ifdef __GLIBCXX_TYPE_INT_N_0
36 static_assert( !std::floating_point<signed __GLIBCXX_TYPE_INT_N_0> );
37 #endif
38
39 static_assert( !std::floating_point<void> );
40 static_assert( !std::floating_point<float*> );
41 static_assert( !std::floating_point<float&> );
42 static_assert( !std::floating_point<float&&> );
43 static_assert( !std::floating_point<const float&> );
44 static_assert( !std::floating_point<float[]> );
45 static_assert( !std::floating_point<float[2]> );
46 static_assert( !std::floating_point<float()> );
47 static_assert( !std::floating_point<float(*)()> );
48 static_assert( !std::floating_point<float(&)()> );
49
50 enum E { };
51 static_assert( !std::floating_point<E> );
52 enum class CE { };
53 static_assert( !std::floating_point<CE> );
54 struct A { };
55 static_assert( !std::floating_point<A> );
56 union B { };
57 static_assert( !std::floating_point<B> );