]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / localization / locales / locale.convenience / conversions / conversions.string / ctor_codecvt.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <locale>
11
12 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
13
14 // wstring_convert(Codecvt* pcvt = new Codecvt);
15
16 #include <locale>
17 #include <codecvt>
18 #include <cassert>
19
20 #include "test_macros.h"
21
22 int main()
23 {
24     {
25         typedef std::codecvt_utf8<wchar_t> Codecvt;
26         typedef std::wstring_convert<Codecvt> Myconv;
27         Myconv myconv;
28         assert(myconv.converted() == 0);
29     }
30     {
31         typedef std::codecvt_utf8<wchar_t> Codecvt;
32         typedef std::wstring_convert<Codecvt> Myconv;
33         Myconv myconv(new Codecvt);
34         assert(myconv.converted() == 0);
35 #if TEST_STD_VER > 11
36         static_assert(!std::is_convertible<Codecvt*, Myconv>::value, "");
37         static_assert( std::is_constructible<Myconv, Codecvt*>::value, "");
38 #endif
39     }
40 }