istream >> bitset<0>
failsSection: 22.9.4 [bitset.operators] Status: C++20 Submitter: Davis Herring Opened: 2019-04-05 Last modified: 2021-02-25
Priority: Not Prioritized
View all other issues in [bitset.operators].
View all issues with C++20 status.
Discussion:
From a StackOverflow question:
[bitset.operators]/5.1 says that extracting a bitset<0>
stops after reading 0 characters.
/6 then says that, since no characters were stored, failbit
is set.
Proposed resolution:
This wording is relative to N4810.
Modify 22.9.4 [bitset.operators] as indicated:
template<class charT, class traits, size_t N> basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>& is, bitset<N>& x);[…]
-6- IfN > 0
and no characters are stored instr
, callsis.setstate(ios_base::failbit)
(which may throwios_base::failure
(31.5.4.4 [iostate.flags])).