C++ Standard Library
  1. C++ Standard Library
  2. STDCXX-332

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development