• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  // <string>
11  
12  // template<> struct char_traits<char16_t>
13  
14  // static void assign(char_type& c1, const char_type& c2);
15  // constexpr in C++17
16  
17  #include <string>
18  #include <cassert>
19  
20  #include "test_macros.h"
21  
22  #if TEST_STD_VER > 14
test_constexpr()23  constexpr bool test_constexpr()
24  {
25      char16_t c = u'1';
26      std::char_traits<char16_t>::assign(c, u'a');
27      return c == u'a';
28  }
29  #endif
30  
main()31  int main()
32  {
33  #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
34  #if TEST_STD_VER >= 11
35      char16_t c = u'\0';
36      std::char_traits<char16_t>::assign(c, u'a');
37      assert(c == u'a');
38  #endif
39  
40  #if TEST_STD_VER > 14
41      static_assert(test_constexpr(), "" );
42  #endif
43  #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
44  }
45