17dad0bd6SMarshall Clow //===----------------------------------------------------------------------===//
27dad0bd6SMarshall Clow //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
67dad0bd6SMarshall Clow //
77dad0bd6SMarshall Clow //===----------------------------------------------------------------------===//
8ee95c702SArthur O'Dwyer 
931cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14, c++17
107dad0bd6SMarshall Clow 
117dad0bd6SMarshall Clow // <string>
127dad0bd6SMarshall Clow 
137dad0bd6SMarshall Clow // template<> struct char_traits<char8_t>
147dad0bd6SMarshall Clow 
157dad0bd6SMarshall Clow // static char_type* assign(char_type* s, size_t n, char_type a);
167dad0bd6SMarshall Clow 
177dad0bd6SMarshall Clow #include <string>
187dad0bd6SMarshall Clow #include <cassert>
197dad0bd6SMarshall Clow 
207fc6a556SMarshall Clow #include "test_macros.h"
217fc6a556SMarshall Clow 
test()22*a40bada9SBrendan Emery TEST_CONSTEXPR_CXX20 bool test() {
23eb1ceb17SJoe Loser #ifndef TEST_HAS_NO_CHAR8_T
247dad0bd6SMarshall Clow   char8_t s2[3] = {0};
257dad0bd6SMarshall Clow   assert(std::char_traits<char8_t>::assign(s2, 3, char8_t(5)) == s2);
267dad0bd6SMarshall Clow   assert(s2[0] == char8_t(5));
277dad0bd6SMarshall Clow   assert(s2[1] == char8_t(5));
287dad0bd6SMarshall Clow   assert(s2[2] == char8_t(5));
297dad0bd6SMarshall Clow   assert(std::char_traits<char8_t>::assign(NULL, 0, char8_t(5)) == NULL);
307dad0bd6SMarshall Clow #endif
312df59c50SJF Bastien 
32eb8710cbSMichael Park   return true;
33eb8710cbSMichael Park }
34eb8710cbSMichael Park 
main(int,char **)35*a40bada9SBrendan Emery int main(int, char**) {
36eb8710cbSMichael Park   test();
37eb8710cbSMichael Park 
38ee95c702SArthur O'Dwyer #if TEST_STD_VER > 17
39eb8710cbSMichael Park   static_assert(test());
40eb8710cbSMichael Park #endif
41eb8710cbSMichael Park 
422df59c50SJF Bastien   return 0;
437dad0bd6SMarshall Clow }
44