types_char32_t.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1//===----------------------------------------------------------------------===//
2//
3// ��������������������The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <locale>
11
12// template <>
13// class codecvt<char32_t, char, mbstate_t>
14//     : public locale::facet,
15//       public codecvt_base
16// {
17// public:
18//     typedef char32_t  intern_type;
19//     typedef char      extern_type;
20//     typedef mbstate_t state_type;
21//     ...
22// };
23
24#include <locale>
25#include <type_traits>
26#include <cassert>
27
28int main()
29{
30//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
31    typedef std::codecvt<char32_t, char, std::mbstate_t> F;
32    static_assert((std::is_base_of<std::locale::facet, F>::value), "");
33    static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
34    static_assert((std::is_same<F::intern_type, char32_t>::value), "");
35    static_assert((std::is_same<F::extern_type, char>::value), "");
36    static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
37    std::locale l = std::locale::classic();
38    assert(std::has_facet<F>(l));
39    const F& f = std::use_facet<F>(l);
40    (void)F::id;
41//#endif
42}
43