types_wchar_t.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
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// template <>
13// class codecvt<wchar_t, char, mbstate_t>
14//     : public locale::facet,
15//       public codecvt_base
16// {
17// public:
18//     typedef wchar_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    typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
31    static_assert((std::is_base_of<std::locale::facet, F>::value), "");
32    static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
33    static_assert((std::is_same<F::intern_type, wchar_t>::value), "");
34    static_assert((std::is_same<F::extern_type, char>::value), "");
35    static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
36    std::locale l = std::locale::classic();
37    assert(std::has_facet<F>(l));
38    const F& f = std::use_facet<F>(l);
39    (void)F::id;
40}
41