summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-11-01 17:32:07 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-11-01 17:32:07 +0000
commit66e7ed959f9373f8596650e94b4176fe694be72a (patch)
tree6e4648508af61828efa7289f444c4e32ef21a518
parent4eaf8ef5cbc1a41a4add1a72de7cc12f3df68f60 (diff)
downloadbcm5719-llvm-66e7ed959f9373f8596650e94b4176fe694be72a.tar.gz
bcm5719-llvm-66e7ed959f9373f8596650e94b4176fe694be72a.zip
peek should set eofbit if sgetc() returns eof.
llvm-svn: 167238
-rw-r--r--libcxx/include/istream4
1 files changed, 4 insertions, 0 deletions
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 72b2004dd53..7b481864250 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -1189,7 +1189,11 @@ basic_istream<_CharT, _Traits>::peek()
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true);
if (__sen)
+ {
__r = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__r, traits_type::eof()))
+ this->setstate(ios_base::eofbit);
+ }
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
OpenPOWER on IntegriCloud