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

source code of libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar_t/assign2.pass.cpp