1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 // UNSUPPORTED: no-wide-characters
16 // RUN: %{exec} %t.exe 2> %t.actual
17 // RUN: echo -n zzzz > %t.expected
18 // RUN: diff %t.expected %t.actual
22 struct custom_codecvt
: std::codecvt
<wchar_t, char, std::mbstate_t> {
23 using base
= std::codecvt
<wchar_t, char, std::mbstate_t>;
25 result
do_out(std::mbstate_t&, const wchar_t *from
, const wchar_t *from_end
,
26 const wchar_t *&from_next
, char *to
, char *to_end
, char *&to_next
) const {
27 while (from
!= from_end
&& to
!= to_end
) {
37 int main(int, char**) {
38 std::locale
loc(std::locale::classic(), new custom_codecvt
);
39 std::wcerr
.imbue(loc
);
40 std::wcerr
<< L
"1234";