xref: /llvm-project/libcxx/test/std/input.output/iostream.forward/iosfwd.pass.cpp (revision 08a0faf4cd32bce6c51027ea9b5ec351747995b4)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <iosfwd>
10 
11 #include <iosfwd>
12 
13 #include "test_macros.h"
14 
15 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
16 #   include <cwchar>
17 #endif
18 
test()19 template <class Ptr> void test()
20 {
21     Ptr p = 0;
22     ((void)p); // Prevent unused warning
23 }
24 
main(int,char **)25 int main(int, char**)
26 {
27     test<std::char_traits<char>*          >();
28 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
29     test<std::char_traits<wchar_t>*       >();
30 #endif
31 
32     test<std::basic_ios<char>*          >();
33 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
34     test<std::basic_ios<wchar_t>*       >();
35 #endif
36     test<std::basic_ios<unsigned short>*>();
37 
38     test<std::basic_streambuf<char>*          >();
39 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
40     test<std::basic_streambuf<wchar_t>*       >();
41 #endif
42     test<std::basic_streambuf<unsigned short>*>();
43 
44     test<std::basic_istream<char>*          >();
45 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
46     test<std::basic_istream<wchar_t>*       >();
47 #endif
48     test<std::basic_istream<unsigned short>*>();
49 
50     test<std::basic_ostream<char>*          >();
51 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
52     test<std::basic_ostream<wchar_t>*       >();
53 #endif
54     test<std::basic_ostream<unsigned short>*>();
55 
56     test<std::basic_iostream<char>*          >();
57 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
58     test<std::basic_iostream<wchar_t>*       >();
59 #endif
60     test<std::basic_iostream<unsigned short>*>();
61 
62     test<std::basic_stringbuf<char>*          >();
63 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
64     test<std::basic_stringbuf<wchar_t>*       >();
65 #endif
66     test<std::basic_stringbuf<unsigned short>*>();
67 
68     test<std::basic_istringstream<char>*          >();
69 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
70     test<std::basic_istringstream<wchar_t>*       >();
71 #endif
72     test<std::basic_istringstream<unsigned short>*>();
73 
74     test<std::basic_ostringstream<char>*          >();
75 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
76     test<std::basic_ostringstream<wchar_t>*       >();
77 #endif
78     test<std::basic_ostringstream<unsigned short>*>();
79 
80     test<std::basic_stringstream<char>*          >();
81 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
82     test<std::basic_stringstream<wchar_t>*       >();
83 #endif
84     test<std::basic_stringstream<unsigned short>*>();
85 
86     test<std::basic_filebuf<char>*          >();
87 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
88     test<std::basic_filebuf<wchar_t>*       >();
89 #endif
90     test<std::basic_filebuf<unsigned short>*>();
91 
92     test<std::basic_ifstream<char>*          >();
93 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
94     test<std::basic_ifstream<wchar_t>*       >();
95 #endif
96     test<std::basic_ifstream<unsigned short>*>();
97 
98     test<std::basic_ofstream<char>*          >();
99 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
100     test<std::basic_ofstream<wchar_t>*       >();
101 #endif
102     test<std::basic_ofstream<unsigned short>*>();
103 
104     test<std::basic_fstream<char>*          >();
105 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
106     test<std::basic_fstream<wchar_t>*       >();
107 #endif
108     test<std::basic_fstream<unsigned short>*>();
109 
110     test<std::istreambuf_iterator<char>*          >();
111 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
112     test<std::istreambuf_iterator<wchar_t>*       >();
113 #endif
114     test<std::istreambuf_iterator<unsigned short>*>();
115 
116     test<std::ostreambuf_iterator<char>*          >();
117 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
118     test<std::ostreambuf_iterator<wchar_t>*       >();
119 #endif
120     test<std::ostreambuf_iterator<unsigned short>*>();
121 
122     test<std::ios* >();
123 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
124     test<std::wios*>();
125 #endif
126 
127     test<std::streambuf*>();
128     test<std::istream*  >();
129     test<std::ostream*  >();
130     test<std::iostream* >();
131 
132     test<std::stringbuf*    >();
133     test<std::istringstream*>();
134     test<std::ostringstream*>();
135     test<std::stringstream* >();
136 
137     test<std::filebuf* >();
138     test<std::ifstream*>();
139     test<std::ofstream*>();
140     test<std::fstream* >();
141 
142 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
143     test<std::wstreambuf*>();
144     test<std::wistream*  >();
145     test<std::wostream*  >();
146     test<std::wiostream* >();
147 
148     test<std::wstringbuf*    >();
149     test<std::wistringstream*>();
150     test<std::wostringstream*>();
151     test<std::wstringstream* >();
152 
153     test<std::wfilebuf* >();
154     test<std::wifstream*>();
155     test<std::wofstream*>();
156     test<std::wfstream* >();
157 #endif
158 
159     test<std::fpos<std::mbstate_t>*>();
160     test<std::streampos*           >();
161 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
162     test<std::wstreampos*          >();
163 #endif
164 
165   return 0;
166 }
167