161d2a9b3SPiotr Fusik //===----------------------------------------------------------------------===//
261d2a9b3SPiotr Fusik //
361d2a9b3SPiotr Fusik // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
461d2a9b3SPiotr Fusik // See https://llvm.org/LICENSE.txt for license information.
561d2a9b3SPiotr Fusik // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
661d2a9b3SPiotr Fusik //
761d2a9b3SPiotr Fusik //===----------------------------------------------------------------------===//
861d2a9b3SPiotr Fusik 
961d2a9b3SPiotr Fusik // UNSUPPORTED: c++03, c++11, c++14, c++17
1061d2a9b3SPiotr Fusik 
1161d2a9b3SPiotr Fusik // <sstream>
1261d2a9b3SPiotr Fusik 
1361d2a9b3SPiotr Fusik // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
1461d2a9b3SPiotr Fusik // class basic_istringstream
1561d2a9b3SPiotr Fusik 
1661d2a9b3SPiotr Fusik // basic_istringstream(ios_base::openmode which, const Allocator& a);
1761d2a9b3SPiotr Fusik 
1861d2a9b3SPiotr Fusik #include <sstream>
1961d2a9b3SPiotr Fusik #include <cassert>
2061d2a9b3SPiotr Fusik 
2161d2a9b3SPiotr Fusik #include "test_allocator.h"
2261d2a9b3SPiotr Fusik #include "test_macros.h"
23*4dee6411SMark de Wever #include "operator_hijacker.h"
2461d2a9b3SPiotr Fusik 
25*4dee6411SMark de Wever template <class CharT, class Allocator>
26*4dee6411SMark de Wever static void test(const Allocator& a) {
27*4dee6411SMark de Wever   const std::basic_istringstream<CharT, std::char_traits<CharT>, Allocator> ss(std::ios_base::binary, a);
2861d2a9b3SPiotr Fusik   assert(ss.rdbuf()->get_allocator() == a);
2961d2a9b3SPiotr Fusik   assert(ss.view().empty());
3061d2a9b3SPiotr Fusik }
3161d2a9b3SPiotr Fusik 
3261d2a9b3SPiotr Fusik int main(int, char**) {
33*4dee6411SMark de Wever   test<char>(test_allocator<char>(2));
34*4dee6411SMark de Wever   test<char>(operator_hijacker_allocator<char>());
3561d2a9b3SPiotr Fusik #ifndef TEST_HAS_NO_WIDE_CHARACTERS
36*4dee6411SMark de Wever   test<wchar_t>(test_allocator<wchar_t>(2));
37*4dee6411SMark de Wever   test<wchar_t>(operator_hijacker_allocator<wchar_t>());
3861d2a9b3SPiotr Fusik #endif
39*4dee6411SMark de Wever 
4061d2a9b3SPiotr Fusik   return 0;
4161d2a9b3SPiotr Fusik }
42