]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_fstream/cons/wchar_t/1.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_fstream / cons / wchar_t / 1.cc
CommitLineData
fbd26352 1// Copyright (C) 2018-2019 Free Software Foundation, Inc.
d4fd5c49 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.
8
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.
13
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/>.
17
18// { dg-do run { target *-*-mingw* } }
19
20#include <fstream>
21#include <testsuite_hooks.h>
22
23void test01()
24{
25 const wchar_t* name = L"fstream_name.txt";
26 std::fstream fs(name, std::wios::out);
27 VERIFY( fs.is_open() );
28}
29
30void test02()
31{
32 const wchar_t name[] = L"fstream_name.txt";
33 std::wfstream wfs(name, std::wios::in|std::wios::out);
34 VERIFY( wfs.is_open() );
35}
36
37#if __cplusplus >= 201103L
38using std::is_constructible;
39using std::fstream;
40using std::wfstream;
41using std::ios;
42static_assert(is_constructible<fstream, const wchar_t*>::value);
43static_assert(is_constructible<fstream, wchar_t*>::value);
44static_assert(is_constructible<fstream, const wchar_t(&)[1]>::value);
45static_assert(is_constructible<fstream, wchar_t(&)[1]>::value);
46static_assert(is_constructible<fstream, const wchar_t*, ios::openmode>::value);
47static_assert(is_constructible<fstream, wchar_t*, ios::openmode>::value);
48static_assert(is_constructible<fstream, const wchar_t(&)[1], ios::openmode>::value);
49static_assert(is_constructible<fstream, wchar_t(&)[1], ios::openmode>::value);
50static_assert(is_constructible<wfstream, const wchar_t*>::value);
51static_assert(is_constructible<wfstream, wchar_t*>::value);
52static_assert(is_constructible<wfstream, const wchar_t(&)[1]>::value);
53static_assert(is_constructible<wfstream, wchar_t(&)[1]>::value);
54static_assert(is_constructible<wfstream, const wchar_t*, ios::openmode>::value);
55static_assert(is_constructible<wfstream, wchar_t*, ios::openmode>::value);
56static_assert(is_constructible<wfstream, const wchar_t(&)[1], ios::openmode>::value);
57static_assert(is_constructible<wfstream, wchar_t(&)[1], ios::openmode>::value);
58#endif
59
60int
61main()
62{
63 test01();
64 test02();
65}