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