https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121054
Bug ID: 121054
Summary: std::bitset<0>("zero") should throw
std::invalid_argument
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
The standard requires that all of the bitset<N> constructors taking a string
check the whole string from [0,n) for invalid characters, not just the first N
characters.
So for bitset<0>("x") and bitset<1>("xx", 2) it should throw, but
bitset<1>("xx", 1) should not (because the 1 says to only use that many
characters from the string).