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 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 
11 // <sstream>
12 
13 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
14 // class basic_stringbuf
15 
16 // void str(basic_string<charT, traits, Allocator>&& s);
17 
18 #include <sstream>
19 #include <cassert>
20 
21 #include "make_string.h"
22 #include "test_macros.h"
23 
24 #define STR(S) MAKE_STRING(CharT, S)
25 
26 template <class CharT>
test()27 static void test() {
28   {
29     std::basic_stringbuf<CharT> buf;
30     std::basic_string<CharT> s(STR("testing"));
31     buf.str(std::move(s));
32     assert(buf.str() == STR("testing"));
33   }
34 }
35 
main(int,char **)36 int main(int, char**) {
37   test<char>();
38 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
39   test<wchar_t>();
40 #endif
41   return 0;
42 }
43