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 // basic_string<charT, traits, SAlloc> str(const SAlloc& sa) const;
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 #define SV(S) MAKE_STRING_VIEW(CharT, S)
28*c7c0095bSPiotr Fusik 
29*c7c0095bSPiotr Fusik template <class CharT>
test()30*c7c0095bSPiotr Fusik static void test() {
31*c7c0095bSPiotr Fusik   const std::basic_stringstream<CharT> ss(STR("testing"));
32*c7c0095bSPiotr Fusik   const test_allocator<CharT> a(1);
33*c7c0095bSPiotr Fusik   const std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT>> s = ss.str(a);
34*c7c0095bSPiotr Fusik   assert(s == SV("testing"));
35*c7c0095bSPiotr Fusik   assert(s.get_allocator() == a);
36*c7c0095bSPiotr Fusik }
37*c7c0095bSPiotr Fusik 
main(int,char **)38*c7c0095bSPiotr Fusik int main(int, char**) {
39*c7c0095bSPiotr Fusik   test<char>();
40*c7c0095bSPiotr Fusik #ifndef TEST_HAS_NO_WIDE_CHARACTERS
41*c7c0095bSPiotr Fusik   test<wchar_t>();
42*c7c0095bSPiotr Fusik #endif
43*c7c0095bSPiotr Fusik   return 0;
44*c7c0095bSPiotr Fusik }
45