1*c7c0095bSPiotr Fusik //===----------------------------------------------------------------------===//
2*c7c0095bSPiotr Fusik //
3*c7c0095bSPiotr Fusik // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*c7c0095bSPiotr Fusik // See https://llvm.org/LICENSE.txt for license information.
5*c7c0095bSPiotr Fusik // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*c7c0095bSPiotr Fusik //
7*c7c0095bSPiotr Fusik //===----------------------------------------------------------------------===//
8*c7c0095bSPiotr Fusik 
9*c7c0095bSPiotr Fusik // UNSUPPORTED: c++03, c++11, c++14, c++17
10*c7c0095bSPiotr Fusik 
11*c7c0095bSPiotr Fusik // <sstream>
12*c7c0095bSPiotr Fusik 
13*c7c0095bSPiotr Fusik // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
14*c7c0095bSPiotr Fusik // class basic_stringstream
15*c7c0095bSPiotr Fusik 
16*c7c0095bSPiotr Fusik // template <class SAlloc>
17*c7c0095bSPiotr Fusik // void str(const basic_string<charT, traits, SAlloc>& s);
18*c7c0095bSPiotr Fusik 
19*c7c0095bSPiotr Fusik #include <sstream>
20*c7c0095bSPiotr Fusik #include <cassert>
21*c7c0095bSPiotr Fusik 
22*c7c0095bSPiotr Fusik #include "make_string.h"
23*c7c0095bSPiotr Fusik #include "test_allocator.h"
24*c7c0095bSPiotr Fusik #include "test_macros.h"
25*c7c0095bSPiotr Fusik 
26*c7c0095bSPiotr Fusik #define STR(S) MAKE_STRING(CharT, S)
27*c7c0095bSPiotr Fusik 
28*c7c0095bSPiotr Fusik template <class CharT>
test()29*c7c0095bSPiotr Fusik static void test() {
30*c7c0095bSPiotr Fusik   {
31*c7c0095bSPiotr Fusik     const test_allocator<CharT> a(6);
32*c7c0095bSPiotr Fusik     const std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT>> s(STR("testing"), a);
33*c7c0095bSPiotr Fusik     std::basic_stringstream<CharT> ss;
34*c7c0095bSPiotr Fusik     ss.str(s);
35*c7c0095bSPiotr Fusik     assert(ss.str() == STR("testing"));
36*c7c0095bSPiotr Fusik   }
37*c7c0095bSPiotr Fusik }
38*c7c0095bSPiotr Fusik 
main(int,char **)39*c7c0095bSPiotr Fusik int main(int, char**) {
40*c7c0095bSPiotr Fusik   test<char>();
41*c7c0095bSPiotr Fusik #ifndef TEST_HAS_NO_WIDE_CHARACTERS
42*c7c0095bSPiotr Fusik   test<wchar_t>();
43*c7c0095bSPiotr Fusik #endif
44*c7c0095bSPiotr Fusik   return 0;
45*c7c0095bSPiotr Fusik }
46