xref: /llvm-project/libcxx/test/std/input.output/iostream.format/std.manip/setfill_wchar_max.pass.cpp (revision 4a2a1b51cb6b88820e28019040fb78d0c82685ab)
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 // Test that WCHAR_MAX as a wchar_t value can be set as the fill character.
10 
11 // UNSUPPORTED: no-wide-characters
12 
13 // Expect the test case to fail on targets where WEOF is the same as
14 // WCHAR_MAX with the libcpp ABI version 1 implementation. The libcpp ABI
15 // version 2 implementation fixes the problem.
16 
17 // XFAIL: target={{.*}}-windows{{.*}} && libcpp-abi-version=1
18 // XFAIL: target=armv{{7|8}}{{l?}}{{.*}}-linux-gnueabihf && libcpp-abi-version=1
19 // XFAIL: target=aarch64{{.*}}-linux-gnu && libcpp-abi-version=1
20 
21 #include <iomanip>
22 #include <ostream>
23 #include <cassert>
24 #include <string>
25 
26 template <class CharT>
27 struct testbuf : public std::basic_streambuf<CharT> {
28   testbuf() {}
29 };
30 
31 int main(int, char**) {
32   testbuf<wchar_t> sb;
33   std::wostream os(&sb);
34   os << std::setfill((wchar_t)WCHAR_MAX);
35   assert(os.fill() == (wchar_t)WCHAR_MAX);
36 
37   return 0;
38 }
39