1 // { dg-add-options ieee }
5 // Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2009
6 // Free Software Foundation
8 // This file is part of the GNU ISO C++ Library. This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING3. If not see
21 // <http://www.gnu.org/licenses/>.
23 // 18.2.1.1 template class numeric_limits
29 #include <testsuite_hooks.h>
36 A(int i = 0): key(i) { }
38 operator==(int i) { return i == key; }
49 bool test __attribute__((unused)) = true;
50 std::numeric_limits< A<B> > obj;
52 VERIFY( !obj.is_specialized );
53 VERIFY( obj.min() == 0 );
54 VERIFY( obj.max() == 0 );
55 VERIFY( obj.digits == 0 );
56 VERIFY( obj.digits10 == 0 );
57 VERIFY( !obj.is_signed );
58 VERIFY( !obj.is_integer );
59 VERIFY( !obj.is_exact );
60 VERIFY( obj.radix == 0 );
61 VERIFY( obj.epsilon() == 0 );
62 VERIFY( obj.round_error() == 0 );
63 VERIFY( obj.min_exponent == 0 );
64 VERIFY( obj.min_exponent10 == 0 );
65 VERIFY( obj.max_exponent == 0 );
66 VERIFY( obj.max_exponent10 == 0 );
67 VERIFY( !obj.has_infinity );
68 VERIFY( !obj.has_quiet_NaN );
69 VERIFY( !obj.has_signaling_NaN );
70 VERIFY( !obj.has_denorm );
71 VERIFY( !obj.has_denorm_loss );
72 VERIFY( obj.infinity() == 0 );
73 VERIFY( obj.quiet_NaN() == 0 );
74 VERIFY( obj.signaling_NaN() == 0 );
75 VERIFY( obj.denorm_min() == 0 );
76 VERIFY( !obj.is_iec559 );
77 VERIFY( !obj.is_bounded );
78 VERIFY( !obj.is_modulo );
80 VERIFY( !obj.tinyness_before );
81 VERIFY( obj.round_style == std::round_toward_zero );
85 // test linkage of the generic bits
86 template struct std::numeric_limits<B>;
90 typedef std::numeric_limits<B> b_nl_type;
92 // Should probably do all of them...
93 const int* __attribute__((unused)) pi1 = &b_nl_type::digits;
94 const int* __attribute__((unused)) pi2 = &b_nl_type::digits10;
95 const int* __attribute__((unused)) pi3 = &b_nl_type::max_exponent10;
96 const bool* __attribute__((unused)) pb1 = &b_nl_type::traps;