]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/locale/cons/12438.cc
1 // { dg-require-namedlocale "" }
3 // Copyright (C) 2003-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 // 22.1.1.2 locale constructors and destructors [lib.locale.cons]
25 #include <testsuite_hooks.h>
27 class MyFacet
: public std::locale::facet
30 static std::locale::id id
;
33 std::locale::id
MyFacet::id
;
36 void test01(int iters
)
39 bool test
__attribute__((unused
)) = true;
41 for (int i
= 0; i
< iters
; ++i
)
45 locale loc1
= locale::classic();
46 locale loc2
= locale("");
47 VERIFY( !has_facet
<MyFacet
>(loc2
) );
49 loc1
.combine
<MyFacet
>(loc2
);
52 catch (std::runtime_error
&)
58 int main(int argc
, char* argv
[])
60 // We leaked ~400-500 bytes/iter.
61 __gnu_test::set_memory_limits(10.0);
65 iters
= atoi(argv
[1]);