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

std::istream::sentry ctor affects gcount()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.1.2, 4.1.3
    • 4.2.0
    • 27. Input/Output
    • None
    • all

    Description

      The istream::sentry ctor is not supposed to change gcount(). Ours does.

      $ cat z.cpp && make z && ./z
      #include <cassert>
      #include <sstream>

      int main ()
      {
      std::istringstream strm (" ");
      const std::istream::sentry sentry (strm);
      assert ((strm.eofbit | strm.failbit) == strm.rdstate ());
      assert (0 == strm.gcount ());
      }
      gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include -I/build/sebor/dev/stdlib/tests/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long z.cpp
      gcc z.o -o z -L/build/sebor/gcc-4.1.0-11s/rwtest -lrwtest11s -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s -lsupc++ -lm
      Assertion failed: 0 == strm.gcount (), file z.cpp, line 9
      Abort (core dumped)

      Attachments

        Issue Links

          Activity

            People

              sebor Martin Sebor
              sebor Martin Sebor
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: