]> gcc.gnu.org Git - gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/2.cc
All files: Update FSF address.
[gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_ostream / inserters_arithmetic / wchar_t / 2.cc
1 // { dg-require-namedlocale "" }
2
3 // Copyright (C) 2005 Free Software Foundation, Inc.
4 //
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)
9 // any later version.
10
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.
15
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,
19 // USA.
20
21 #include <iostream>
22 #include <iomanip>
23 #include <locale>
24 #include <sstream>
25 #include <limits>
26 #include <testsuite_hooks.h>
27
28 void
29 test02()
30 {
31 using namespace std;
32 bool test __attribute__((unused)) = true;
33
34 // Make sure we can output a long float in fixed format
35 // without seg-faulting (libstdc++/4402)
36 double val2 = 3.5e230;
37
38 wostringstream os2;
39 os2.precision(3);
40 os2.setf(wios::fixed);
41
42 // Check it can be done in a locale with grouping on.
43 locale loc2 = locale("de_DE");
44 os2.imbue(loc2);
45 os2 << fixed << setprecision(3) << val2 << endl;
46 os2 << endl;
47 os2 << fixed << setprecision(1) << val2 << endl;
48 }
49
50 int
51 main()
52 {
53 test02();
54 return 0;
55 }
This page took 0.03965 seconds and 5 git commands to generate.