diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2013-07-01 00:37:50 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2013-07-01 00:37:50 +0000 |
| commit | eecacc0fadb4f1fcb2297b5dbcca5c610e8f8c21 (patch) | |
| tree | 975eab90e94176f660c10206e8bd95478c74606a /libcxx/test | |
| parent | 9dbbf8dece177a54760b7ce6f4b3efc3e4380483 (diff) | |
| download | bcm5719-llvm-eecacc0fadb4f1fcb2297b5dbcca5c610e8f8c21.tar.gz bcm5719-llvm-eecacc0fadb4f1fcb2297b5dbcca5c610e8f8c21.zip | |
In istream::ignore, check the delimeter as an int_type, not as a char_type, so as to correctly handle EOF. This fixes http://llvm.org/bugs/show_bug.cgi?id=16427
llvm-svn: 185298
Diffstat (limited to 'libcxx/test')
| -rw-r--r-- | libcxx/test/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libcxx/test/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp b/libcxx/test/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp new file mode 100644 index 00000000000..ab0326cf0c9 --- /dev/null +++ b/libcxx/test/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <istream> + +// basic_istream<charT,traits>& +// ignore(streamsize n = 1, int_type delim = traits::eof()); + +// http://llvm.org/bugs/show_bug.cgi?id=16427 + +#include <sstream> +#include <cassert> + +int main() +{ + int bad=-1; + std::ostringstream os; + os << "aaaabbbb" << static_cast<char>(bad) + << "ccccdddd" << std::endl; + std::string s=os.str(); + + std::istringstream is(s); + const unsigned int ignoreLen=10; + size_t a=is.tellg(); + is.ignore(ignoreLen); + size_t b=is.tellg(); + assert((b-a)==ignoreLen); +} |

