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

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