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]
24 #include <testsuite_hooks.h>
26 class MyFacet
: public std::locale::facet
29 static std::locale::id id
;
32 std::locale::id
MyFacet::id
;
35 void test01(int iters
)
38 bool test
__attribute__((unused
)) = true;
40 for (int i
= 0; i
< iters
; ++i
)
44 locale loc1
= locale::classic();
45 locale loc2
= __gnu_test::try_named_locale("");
46 VERIFY( !has_facet
<MyFacet
>(loc2
) );
48 loc1
.combine
<MyFacet
>(loc2
);
51 catch (std::runtime_error
&)
57 int main(int argc
, char* argv
[])
59 // We leaked ~400-500 bytes/iter.
60 __gnu_test::set_memory_limits(10.0);
64 iters
= atoi(argv
[1]);