2018-08-31 Sandra Loosemore <sandra@codesourcery.com>
[official-gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_ofstream / cons / wchar_t / 1.cc
blobe26c2ea20acd0e8bb409f02ee9fcdaa5ad7be4eb
1 // Copyright (C) 2018 Free Software Foundation, Inc.
2 //
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 3, or (at your option)
7 // any later version.
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 COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-do run { target *-*-mingw* } }
19 // { dg-require-fileio "" }
21 #include <fstream>
22 #include <testsuite_hooks.h>
24 void test01()
26 const wchar_t* name = L"ofstream_name.txt";
27 std::ofstream ofs(name);
28 VERIFY( ofs.is_open() );
31 void test02()
33 const wchar_t name[] = L"ofstream_name.txt";
34 std::wofstream wofs(name, std::wios::out);
35 VERIFY( wofs.is_open() );
38 #if __cplusplus >= 201103L
39 using std::is_constructible;
40 using std::ofstream;
41 using std::wofstream;
42 using std::ios;
43 using std::wios;
44 static_assert(is_constructible<ofstream, const wchar_t*>::value);
45 static_assert(is_constructible<ofstream, wchar_t*>::value);
46 static_assert(is_constructible<ofstream, const wchar_t(&)[1]>::value);
47 static_assert(is_constructible<ofstream, wchar_t(&)[1]>::value);
48 static_assert(is_constructible<ofstream, const wchar_t*, ios::openmode>::value);
49 static_assert(is_constructible<ofstream, wchar_t*, ios::openmode>::value);
50 static_assert(is_constructible<ofstream, const wchar_t(&)[1], ios::openmode>::value);
51 static_assert(is_constructible<ofstream, wchar_t(&)[1], ios::openmode>::value);
52 static_assert(is_constructible<wofstream, const wchar_t*>::value);
53 static_assert(is_constructible<wofstream, wchar_t*>::value);
54 static_assert(is_constructible<wofstream, const wchar_t(&)[1]>::value);
55 static_assert(is_constructible<wofstream, wchar_t(&)[1]>::value);
56 static_assert(is_constructible<wofstream, const wchar_t*, wios::openmode>::value);
57 static_assert(is_constructible<wofstream, wchar_t*, wios::openmode>::value);
58 static_assert(is_constructible<wofstream, const wchar_t(&)[1], wios::openmode>::value);
59 static_assert(is_constructible<wofstream, wchar_t(&)[1], wios::openmode>::value);
60 #endif
62 int
63 main()
65 test01();
66 test02();