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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 4.1.3
    • Fix Version/s: None
    • Component/s: 27. Input/Output
    • Labels:
      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

              • Assignee:
                Unassigned
                Reporter:
                mbrown Mark Brown
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: