brintos

brintos / llvm-project-archived public Read only

0
0
Text · 931 B · 0dca0e2 Raw
40 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 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++1714// constexpr in C++1715 16#include <string>17#include <cassert>18 19#include "test_macros.h"20 21#if TEST_STD_VER > 1422constexpr bool test_constexpr() {23  char c = '1';24  std::char_traits<char>::assign(c, 'a');25  return c == 'a';26}27#endif28 29int main(int, char**) {30  char c = '\0';31  std::char_traits<char>::assign(c, 'a');32  assert(c == 'a');33 34#if TEST_STD_VER > 1435  static_assert(test_constexpr(), "");36#endif37 38  return 0;39}40