1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <string> 10 11 // template<> struct char_traits<char16_t> 12 13 // static void assign(char_type& c1, const char_type& c2); 14 // constexpr in C++17 15 16 #include <string> 17 #include <cassert> 18 19 #include "test_macros.h" 20 21 #if TEST_STD_VER > 14 test_constexpr()22constexpr bool test_constexpr() 23 { 24 char16_t c = u'1'; 25 std::char_traits<char16_t>::assign(c, u'a'); 26 return c == u'a'; 27 } 28 #endif 29 main(int,char **)30int main(int, char**) 31 { 32 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 33 #if TEST_STD_VER >= 11 34 char16_t c = u'\0'; 35 std::char_traits<char16_t>::assign(c, u'a'); 36 assert(c == u'a'); 37 #endif 38 39 #if TEST_STD_VER > 14 40 static_assert(test_constexpr(), "" ); 41 #endif 42 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS 43 44 return 0; 45 } 46