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 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 10 // <string> 11 12 // template<> struct char_traits<char8_t> 13 14 // static constexpr void assign(char_type& c1, const char_type& c2); 15 16 #include <string> 17 #include <cassert> 18 19 #include "test_macros.h" 20 21 #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L test_constexpr()22constexpr bool test_constexpr() 23 { 24 char8_t c = u'1'; 25 std::char_traits<char8_t>::assign(c, u'a'); 26 return c == u'a'; 27 } 28 main()29int main() 30 { 31 char8_t c = u8'\0'; 32 std::char_traits<char8_t>::assign(c, u8'a'); 33 assert(c == u8'a'); 34 35 static_assert(test_constexpr(), ""); 36 } 37 #else main()38int main () {} 39 #endif 40