1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <streambuf> 11 12 // template <class charT, class traits = char_traits<charT> > 13 // class basic_streambuf; 14 15 // void pbump(int n); 16 17 #include <sstream> 18 #include <cassert> 19 #include "test_macros.h" 20 21 struct SB : std::stringbuf 22 { 23 SB() : std::stringbuf(std::ios::ate|std::ios::out) { } 24 const char* pubpbase() const { return pbase(); } 25 const char* pubpptr() const { return pptr(); } 26 }; 27 28 int main() 29 { 30 #ifndef TEST_HAS_NO_EXCEPTIONS 31 try { 32 #endif 33 std::string str(2147483648, 'a'); 34 SB sb; 35 sb.str(str); 36 assert(sb.pubpbase() <= sb.pubpptr()); 37 #ifndef TEST_HAS_NO_EXCEPTIONS 38 } 39 catch (const std::bad_alloc &) {} 40 #endif 41 } 42