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

            Bug ID: 109922
           Summary: <iomanip>: consider removing operator>> for istream >>
                    setfill(c)
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fsb4000 at yandex dot ru
  Target Milestone: ---

Hi.

This is a mirror of a bug report: https://github.com/microsoft/STL/issues/3724

I noticed that libstdc++ has the same bug but LLVM libc++ doesn't have.

Look at the code

#include <iostream>
#include <iomanip>

int main()
{
    std::cin >> std::setfill('*');
}

According to the
standard(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4944.pdf),
std::setfill is only for ostreams. Therefore, istream >> setfill(c) has no
well-defined meaning and can lead to confusion:
https://stackoverflow.com/questions/42530114/stdsetfill-and-stdsetw-for-input-streams

Initially reported by @achabense (https://github.com/achabense)

Reply via email to