1 // { dg-require-namedlocale "" }
3 // Copyright (C) 2003, 2005 Free Software Foundation
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 2, 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 COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // 22.1.1.2 locale constructors and destructors [lib.locale.cons]
27 #include <testsuite_hooks.h>
29 int times_to_fail
= 0;
31 void* allocate(std::size_t n
)
36 void* ret
= std::malloc(n
? n
: 1);
38 std::memset(ret
, 0xbc, n
);
42 void deallocate(void* p
)
48 void* operator new(std::size_t n
) throw (std::bad_alloc
)
50 void* ret
= allocate(n
);
52 throw std::bad_alloc();
56 void* operator new[](std::size_t n
) throw (std::bad_alloc
)
58 void* ret
= allocate(n
);
60 throw std::bad_alloc();
64 void operator delete(void* p
) throw()
69 void operator delete[](void* p
) throw()
74 void* operator new(std::size_t n
, const std::nothrow_t
&) throw()
79 void* operator new[](std::size_t n
, const std::nothrow_t
&) throw()
84 void operator delete(void* p
, const std::nothrow_t
&) throw()
89 void operator delete[](void* p
, const std::nothrow_t
&) throw()
95 void test01(int iters
)
97 bool test
__attribute__((unused
)) = true;
99 for (int j
= 0; j
< iters
; ++j
)
101 for (int i
= 0; i
< 100; ++i
)
106 std::locale loc1
= std::locale("");
107 std::locale
loc2(loc1
, std::locale::classic(),
108 std::locale::numeric
);
110 catch (std::exception
&)
117 int main(int argc
, char* argv
[])
121 iters
= std::atoi(argv
[1]);