diff --git a/libcxx/include/istream b/libcxx/include/istream --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -1619,7 +1619,7 @@ __is.rdbuf()->sbumpc(); } __x = bitset<_Size>(__str); - if (__c == 0) + if (_Size > 0 && __c == 0) __state |= ios_base::failbit; #ifndef _LIBCPP_NO_EXCEPTIONS } diff --git a/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp --- a/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp @@ -25,6 +25,18 @@ in >> b; assert(b.to_ulong() == 0x5A); } + { + // Make sure that input-streaming an empty bitset does not cause the + // failbit to be set (LWG 3199). + std::istringstream in("01011010"); + std::bitset<0> b; + in >> b; + assert(b.to_string() == ""); + assert(!in.bad()); + assert(!in.fail()); + assert(!in.eof()); + assert(in.good()); + } #ifndef TEST_HAS_NO_EXCEPTIONS { std::stringbuf sb; diff --git a/libcxx/www/upcoming_meeting.html b/libcxx/www/upcoming_meeting.html --- a/libcxx/www/upcoming_meeting.html +++ b/libcxx/www/upcoming_meeting.html @@ -71,7 +71,7 @@