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 // XFAIL: no-wide-characters 10 11 // UNSUPPORTED: c++03 12 13 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT 14 15 // <locale> 16 17 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc> 18 19 // wstring_convert(wstring_convert&& other); // EXTENSION 20 21 #include <locale> 22 #include <codecvt> 23 #include <cassert> 24 25 #include "test_macros.h" 26 main(int,char **)27int main(int, char**) 28 { 29 typedef std::codecvt_utf8<wchar_t> Codecvt; 30 typedef std::wstring_convert<Codecvt> Myconv; 31 // create a converter and perform some conversions to generate some 32 // interesting state. 33 Myconv myconv; 34 myconv.from_bytes("\xEF\xBF\xBD"); 35 const auto old_converted = myconv.converted(); 36 assert(myconv.converted() == 3); 37 // move construct a new converter and make sure the state is the same. 38 Myconv myconv2(std::move(myconv)); 39 assert(myconv2.converted() == old_converted); 40 41 return 0; 42 } 43