3 // Copyright (C) 2000-2014 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // 27.4.2.5 ios_base storage functions
22 // This fails on some versions of Darwin 8 because malloc doesn't return
23 // NULL even if an allocation fails (filed as Radar 3884894).
24 // { dg-do run { xfail *-*-darwin8.[0-4].* } }
26 // Skip test at -m64 on Darwin because RLIMITS are not being honored.
27 // Radar 6467883: 10.4/10.5 setrlimits are not honored by memory allocators
28 // Radar 6467884: 10.X systems are not robust when paging space is exceeded
29 // { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } }
31 // The library still throws the original definition of std::ios::failure
32 // { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
37 #include <testsuite_hooks.h>
42 bool test
__attribute__((unused
)) = true;
43 int max
= std::numeric_limits
<int>::max() - 1;
44 std::stringbuf strbuf
;
45 std::ios
ios(&strbuf
);
47 ios
.exceptions(std::ios::badbit
);
54 VERIFY( ios
.pword(1) == v
);
60 catch(std::ios_base::failure
& obj
)
72 VERIFY( ios
.pword(1) == v
);
74 // max is different code path from max-1
78 v
= ios
.pword(std::numeric_limits
<int>::max());
80 catch(std::ios_base::failure
& obj
)
94 VERIFY( ios
.iword(1) == 1 );
100 catch(std::ios_base::failure
& obj
)
112 VERIFY( ios
.iword(1) == 1 );
114 // max is different code path from max-1
118 l
= ios
.iword(std::numeric_limits
<int>::max());
120 catch(std::ios_base::failure
& obj
)
136 __gnu_test::set_memory_limits();