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// REQUIRES: locale.en_US.UTF-8
11
12// <locale>
13
14// template <class CharT>
15// class ctype_byname
16//     : public ctype<CharT>
17// {
18// public:
19//     explicit ctype_byname(const char*, size_t = 0);
20//     explicit ctype_byname(const string&, size_t = 0);
21//
22// protected:
23//     ~ctype_byname();
24// };
25
26#include <locale>
27#include <type_traits>
28#include <cassert>
29
30#include "platform_support.h" // locale name macros
31
32int main()
33{
34    {
35        std::locale l(LOCALE_en_US_UTF_8);
36        {
37            assert(std::has_facet<std::ctype_byname<char> >(l));
38            assert(&std::use_facet<std::ctype<char> >(l)
39                == &std::use_facet<std::ctype_byname<char> >(l));
40        }
41        {
42            assert(std::has_facet<std::ctype_byname<wchar_t> >(l));
43            assert(&std::use_facet<std::ctype<wchar_t> >(l)
44                == &std::use_facet<std::ctype_byname<wchar_t> >(l));
45        }
46    }
47    {
48        std::locale l("C");
49        {
50            assert(std::has_facet<std::ctype_byname<char> >(l));
51            assert(&std::use_facet<std::ctype<char> >(l)
52                == &std::use_facet<std::ctype_byname<char> >(l));
53        }
54        {
55            assert(std::has_facet<std::ctype_byname<wchar_t> >(l));
56            assert(&std::use_facet<std::ctype<wchar_t> >(l)
57                == &std::use_facet<std::ctype_byname<wchar_t> >(l));
58        }
59    }
60}
61