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

[LWG #453] ostringstream::tellp() returns -1 when the stream is empty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 4.1.3
    • None
    • 27. Input/Output
    • None

    Description

      When I call tellp() on an empty stringstream I get -1 instead of 0.

      #include <cassert>
      #include <sstream>

      main()
      {
      std::ostringstream out;
      std::ios::pos_type pos = out .tellp () ;

      assert (pos == 0);

      return 0;
      }

      test: test.cpp:9: int main(): Assertion `pos == 0' failed.
      Aborted

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mbrown Mark Brown
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: