Home | History | Annotate | Download | only in char.traits.specializations.char
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <string>
     11 
     12 // template<> struct char_traits<char>
     13 
     14 // static constexpr void assign(char_type& c1, const char_type& c2); // constexpr in C++17
     15 // constexpr in C++17
     16 
     17 #include <string>
     18 #include <cassert>
     19 
     20 #include "test_macros.h"
     21 
     22 #if TEST_STD_VER > 14
     23 constexpr bool test_constexpr()
     24 {
     25     char c = '1';
     26     std::char_traits<char>::assign(c, 'a');
     27     return c == 'a';
     28 }
     29 #endif
     30 
     31 int main()
     32 {
     33     char c = '\0';
     34     std::char_traits<char>::assign(c, 'a');
     35     assert(c == 'a');
     36 
     37 #if TEST_STD_VER > 14
     38     static_assert(test_constexpr(), "" );
     39 #endif
     40 }
     41