1 // { dg-require-namedlocale "" }
3 // Copyright (C) 2003, 2005, 2009 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 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 // 22.1.1.2 locale constructors and destructors [lib.locale.cons]
26 #include <testsuite_hooks.h>
28 int times_to_fail = 0;
30 void* allocate(std::size_t n)
35 void* ret = std::malloc(n ? n : 1);
37 std::memset(ret, 0xbc, n);
41 void deallocate(void* p)
47 void* operator new(std::size_t n) throw (std::bad_alloc)
49 void* ret = allocate(n);
51 throw std::bad_alloc();
55 void* operator new[](std::size_t n) throw (std::bad_alloc)
57 void* ret = allocate(n);
59 throw std::bad_alloc();
63 void operator delete(void* p) throw()
68 void operator delete[](void* p) throw()
73 void* operator new(std::size_t n, const std::nothrow_t&) throw()
78 void* operator new[](std::size_t n, const std::nothrow_t&) throw()
83 void operator delete(void* p, const std::nothrow_t&) throw()
88 void operator delete[](void* p, const std::nothrow_t&) throw()
94 void test01(int iters)
96 bool test __attribute__((unused)) = true;
98 for (int j = 0; j < iters; ++j)
100 for (int i = 0; i < 100; ++i)
105 std::locale loc1 = std::locale("");
106 std::locale loc2(loc1, std::locale::classic(),
107 std::locale::numeric);
109 catch (std::exception&)
116 int main(int argc, char* argv[])
120 iters = std::atoi(argv[1]);