Home | History | Annotate | Download | only in char.traits.specializations.char32_t
      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<char32_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
     23 constexpr bool test_constexpr()
     24 {
     25     char32_t c = U'1';
     26     std::char_traits<char32_t>::assign(c, U'a');
     27     return c == U'a';
     28 }
     29 #endif
     30 
     31 int main()
     32 {
     33 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
     34 #if TEST_STD_VER >= 11
     35     char32_t c = U'\0';
     36     std::char_traits<char32_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