Title
istream >> bitset<0> fails
Status
c++20
Section
[bitset.operators]
Submitter
Davis Herring

Created on 2019-04-05.00:00:00 last changed 46 months ago

Messages

Date: 2019-04-06.16:35:32

Proposed resolution:

This wording is relative to N4810.

  1. Modify [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- If N > 0 and no characters are stored in str, calls is.setstate(ios_base::failbit) (which may throw ios_base::failure ([iostate.flags])).

Date: 2019-06-10.05:20:17

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.

[2019-06-09; Priority to 0 and Status to Tentatively Ready after five positive votes on the reflector.]
History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2019-07-22 15:46:37adminsetstatus: voting -> wp
2019-06-17 05:25:36adminsetstatus: ready -> voting
2019-06-10 05:20:17adminsetstatus: new -> ready
2019-04-06 16:35:32adminsetmessages: + msg10389
2019-04-05 00:00:00admincreate