]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/ext/enc_filebuf/wchar_t/13189.cc
re PR testsuite/39696 (gcc.dg/tree-ssa/ssa-ccp-25.c scan-tree-dump doesn't work on...
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / ext / enc_filebuf / wchar_t / 13189.cc
CommitLineData
4ffe6e87
BK
1// { dg-require-iconv "ISO-8859-1" }
2
3// Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation
2ad00228
PC
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
83f51799 18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2ad00228
PC
19// USA.
20
d13cebde 21#include <testsuite_hooks.h>
42134429 22#include <ext/enc_filebuf.h>
2ad00228 23
57616df1 24void test01()
2ad00228 25{
2ad00228 26 using namespace std;
42134429
BK
27 typedef wchar_t char_type;
28 typedef __gnu_cxx::enc_filebuf<char_type> filebuf_type;
4ffe6e87 29 typedef filebuf_type::state_type state_type;
42134429 30 typedef codecvt<char_type, char, state_type> enc_codecvt;
2ad00228 31
42134429
BK
32 bool test __attribute__((unused)) = true;
33 ios_base::openmode mode = ios_base::in | ios_base::out | ios_base::trunc;
34 try
35 {
36 state_type st;
37 filebuf_type fbuf(st);
38 locale loc(locale::classic(), new enc_codecvt);
39 fbuf.pubimbue(loc);
40 fbuf.open("tmp_13189w", mode);
41 fbuf.sputc(L'a');
42 fbuf.pubseekoff(0, ios_base::beg);
43 fbuf.sgetc();
44 fbuf.close();
45 }
46 catch(...)
47 {
42134429 48 }
d517f626 49}
57616df1
BK
50
51int main()
52{
53 test01();
54 return 0;
2ad00228 55}