]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/18_support/numeric_limits/specialization_default_values.cc
75549ff685bff968f1a39f910543b44e0d2dd0e9
1 // { dg-add-options ieee }
5 // Copyright (C) 1999-2024 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 // 18.2.1.1 template class numeric_limits
28 #include <testsuite_hooks.h>
35 A(int i
= 0): key(i
) { }
37 operator==(int i
) { return i
== key
; }
48 std::numeric_limits
< A
<B
> > obj
;
50 VERIFY( !obj
.is_specialized
);
51 VERIFY( obj
.min() == 0 );
52 VERIFY( obj
.max() == 0 );
53 VERIFY( obj
.digits
== 0 );
54 VERIFY( obj
.digits10
== 0 );
55 VERIFY( !obj
.is_signed
);
56 VERIFY( !obj
.is_integer
);
57 VERIFY( !obj
.is_exact
);
58 VERIFY( obj
.radix
== 0 );
59 VERIFY( obj
.epsilon() == 0 );
60 VERIFY( obj
.round_error() == 0 );
61 VERIFY( obj
.min_exponent
== 0 );
62 VERIFY( obj
.min_exponent10
== 0 );
63 VERIFY( obj
.max_exponent
== 0 );
64 VERIFY( obj
.max_exponent10
== 0 );
65 VERIFY( !obj
.has_infinity
);
66 VERIFY( !obj
.has_quiet_NaN
);
67 VERIFY( !obj
.has_signaling_NaN
);
68 VERIFY( !obj
.has_denorm
);
69 VERIFY( !obj
.has_denorm_loss
);
70 VERIFY( obj
.infinity() == 0 );
71 VERIFY( obj
.quiet_NaN() == 0 );
72 VERIFY( obj
.signaling_NaN() == 0 );
73 VERIFY( obj
.denorm_min() == 0 );
74 VERIFY( !obj
.is_iec559
);
75 VERIFY( !obj
.is_bounded
);
76 VERIFY( !obj
.is_modulo
);
78 VERIFY( !obj
.tinyness_before
);
79 VERIFY( obj
.round_style
== std::round_toward_zero
);
82 // test linkage of the generic bits
83 template struct std::numeric_limits
<B
>;
87 typedef std::numeric_limits
<B
> b_nl_type
;
89 // Should probably do all of them...
90 const int* __attribute__((unused
)) pi1
= &b_nl_type::digits
;
91 const int* __attribute__((unused
)) pi2
= &b_nl_type::digits10
;
92 const int* __attribute__((unused
)) pi3
= &b_nl_type::max_exponent10
;
93 const bool* __attribute__((unused
)) pb1
= &b_nl_type::traps
;