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