1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <istream>
10 
11 // basic_istream<charT,traits>&
12 //    ignore(streamsize n = 1, int_type delim = traits::eof());
13 
14 // https://llvm.org/PR16427
15 
16 #include <sstream>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 
main(int,char **)21 int main(int, char**)
22 {
23     int bad=-1;
24     std::ostringstream os;
25     os << "aaaabbbb" << static_cast<char>(bad)
26        << "ccccdddd" << std::endl;
27     std::string s=os.str();
28 
29     std::istringstream is(s);
30     const unsigned int ignoreLen=10;
31     std::istringstream::pos_type a=is.tellg();
32     is.ignore(ignoreLen);
33     std::istringstream::pos_type b=is.tellg();
34     assert((b-a)==ignoreLen);
35 
36   return 0;
37 }
38