https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108214

            Bug ID: 108214
           Summary: writinng bitset to stringstream fails
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rhalbersma at gmail dot com
  Target Milestone: ---

#include <bitset>
#include <sstream>

int main() {
    using T = std::bitset<1>;
    T a(1);
    T b;
    std::stringstream sstr;
    sstr << a;
    sstr >> b;
}

The above program works correctly for g++ until version 12, but for version 13
(trunk) it errors out with: "terminate called after throwing an instance of
'std::invalid_argument' what():  bitset::_M_copy_from_ptr"

Godbolt link: https://godbolt.org/z/nnKT6cddb

Reply via email to