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 // <istream> 11 12 // basic_istream<charT,traits>& 13 // ignore(streamsize n = 1, int_type delim = traits::eof()); 14 15 // http://llvm.org/bugs/show_bug.cgi?id=16427 16 17 #include <sstream> 18 #include <cassert> 19 20 int main() 21 { 22 int bad=-1; 23 std::ostringstream os; 24 os << "aaaabbbb" << static_cast<char>(bad) 25 << "ccccdddd" << std::endl; 26 std::string s=os.str(); 27 28 std::istringstream is(s); 29 const unsigned int ignoreLen=10; 30 size_t a=is.tellg(); 31 is.ignore(ignoreLen); 32 size_t b=is.tellg(); 33 assert((b-a)==ignoreLen); 34 } 35