1 // Copyright (C) 2003 Free Software Foundation
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 2, or (at your option)
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.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING. If not, write to the Free
16 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // 22.1.1.2 locale constructors and destructors [lib.locale.cons]
25 #include <testsuite_hooks.h>
27 int times_to_fail
= 0;
29 void* allocate(std::size_t n
)
34 void* ret
= std::malloc(n
? n
: 1);
36 std::memset(ret
, 0xbc, n
);
40 void deallocate(void* p
)
46 void* operator new(std::size_t n
) throw (std::bad_alloc
)
48 void* ret
= allocate(n
);
50 throw std::bad_alloc();
54 void* operator new[](std::size_t n
) throw (std::bad_alloc
)
56 void* ret
= allocate(n
);
58 throw std::bad_alloc();
62 void operator delete(void* p
) throw()
67 void operator delete[](void* p
) throw()
72 void* operator new(std::size_t n
, const std::nothrow_t
&) throw()
77 void* operator new[](std::size_t n
, const std::nothrow_t
&) throw()
82 void operator delete(void* p
, const std::nothrow_t
&) throw()
87 void operator delete[](void* p
, const std::nothrow_t
&) throw()
93 void test01(int iters
)
95 bool test
__attribute__((unused
)) = true;
97 for (int j
= 0; j
< iters
; ++j
)
99 for (int i
= 0; i
< 100; ++i
)
104 std::locale loc1
= __gnu_test::try_named_locale("");
105 std::locale
loc2(loc1
, std::locale::classic(),
106 std::locale::numeric
);
108 catch (std::exception
&)
115 int main(int argc
, char* argv
[])
119 iters
= std::atoi(argv
[1]);