1c7c0095bSPiotr Fusik //===----------------------------------------------------------------------===// 2c7c0095bSPiotr Fusik // 3c7c0095bSPiotr Fusik // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4c7c0095bSPiotr Fusik // See https://llvm.org/LICENSE.txt for license information. 5c7c0095bSPiotr Fusik // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6c7c0095bSPiotr Fusik // 7c7c0095bSPiotr Fusik //===----------------------------------------------------------------------===// 8c7c0095bSPiotr Fusik 9c7c0095bSPiotr Fusik // UNSUPPORTED: c++03, c++11, c++14, c++17 10c7c0095bSPiotr Fusik 11c7c0095bSPiotr Fusik // <sstream> 12c7c0095bSPiotr Fusik 13c7c0095bSPiotr Fusik // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>> 14c7c0095bSPiotr Fusik // class basic_stringstream 15c7c0095bSPiotr Fusik 16c7c0095bSPiotr Fusik // basic_stringstream(ios_base::openmode which, const Allocator& a); 17c7c0095bSPiotr Fusik 18c7c0095bSPiotr Fusik #include <cassert> 19*4dee6411SMark de Wever #include <sstream> 20c7c0095bSPiotr Fusik 21c7c0095bSPiotr Fusik #include "test_allocator.h" 22c7c0095bSPiotr Fusik #include "test_macros.h" 23*4dee6411SMark de Wever #include "operator_hijacker.h" 24c7c0095bSPiotr 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_stringstream<CharT, std::char_traits<CharT>, Allocator> ss(std::ios_base::in, a); 28c7c0095bSPiotr Fusik assert(ss.rdbuf()->get_allocator() == a); 29c7c0095bSPiotr Fusik assert(ss.view().empty()); 30c7c0095bSPiotr Fusik } 31c7c0095bSPiotr Fusik 32c7c0095bSPiotr 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>()); 35c7c0095bSPiotr 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>()); 38c7c0095bSPiotr Fusik #endif 39c7c0095bSPiotr Fusik return 0; 40c7c0095bSPiotr Fusik } 41