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