| 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 | // XFAIL: target=aarch64{{.*}}-amazon-linux && libcpp-abi-version=1 |
| 21 | |
| 22 | #include <iomanip> |
| 23 | #include <ostream> |
| 24 | #include <cassert> |
| 25 | #include <string> |
| 26 | |
| 27 | template <class CharT> |
| 28 | struct testbuf : public std::basic_streambuf<CharT> { |
| 29 | testbuf() {} |
| 30 | }; |
| 31 | |
| 32 | int main(int, char**) { |
| 33 | testbuf<wchar_t> sb; |
| 34 | std::wostream os(&sb); |
| 35 | os << std::setfill((wchar_t)WCHAR_MAX); |
| 36 | assert(os.fill() == (wchar_t)WCHAR_MAX); |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |