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