38 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8// UNSUPPORTED: c++03, c++11, c++14, c++179// <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#ifndef TEST_HAS_NO_CHAR8_T21constexpr bool test_constexpr() {22 char8_t c = u8'1';23 std::char_traits<char8_t>::assign(c, u'a');24 return c == u8'a';25}26 27int main(int, char**) {28 char8_t c = u8'\0';29 std::char_traits<char8_t>::assign(c, u8'a');30 assert(c == u8'a');31 32 static_assert(test_constexpr(), "");33 return 0;34}35#else36int main(int, char**) { return 0; }37#endif38