Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-205

std::operator<<(ostream, string) calls width(0) regardless of sentry

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.1.3
    • Fix Version/s: 4.2.0
    • Component/s: 21. Strings
    • Labels:
      None
    • Environment:

      all

      Description

      The following test fails:

      #include <iostream>
      #include <sstream>
      #include <string>
      #include <cassert>

      int main(int argc, char* argv[])
      {
      std::string str ("abcdefghijk");
      std::ostringstream os;
      const std::streamsize width = 2;

      os.width (width);
      os.clear (std::ios_base::failbit);

      os << str;
      assert (os.width () == width);

      return 0;
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sebor Martin Sebor
                Reporter:
                pevtsov Anton Pevtsov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: