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 //===----------------------------------------------------------------------===//
11 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
13 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
15 // wstring_convert(Codecvt* pcvt = new Codecvt); // before C++14
16 // explicit wstring_convert(Codecvt* pcvt = new Codecvt); // before C++20
17 // wstring_convert() : wstring_convert(new Codecvt) {} // C++20
18 // explicit wstring_convert(Codecvt* pcvt); // C++20
20 // XFAIL: no-wide-characters
26 #include "test_macros.h"
27 #if TEST_STD_VER >= 11
28 #include "test_convertible.h"
34 typedef std::codecvt_utf8
<wchar_t> Codecvt
;
35 typedef std::wstring_convert
<Codecvt
> Myconv
;
37 assert(myconv
.converted() == 0);
40 typedef std::codecvt_utf8
<wchar_t> Codecvt
;
41 typedef std::wstring_convert
<Codecvt
> Myconv
;
42 Myconv
myconv(new Codecvt
);
43 assert(myconv
.converted() == 0);
45 static_assert(!std::is_convertible
<Codecvt
*, Myconv
>::value
, "");
46 static_assert( std::is_constructible
<Myconv
, Codecvt
*>::value
, "");
50 #if TEST_STD_VER >= 11
52 typedef std::codecvt_utf8
<wchar_t> Codecvt
;
53 typedef std::wstring_convert
<Codecvt
> B
;
54 static_assert(test_convertible
<B
>(), "");
55 static_assert(!test_convertible
<B
, Codecvt
*>(), "");