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

std::ostream::operator<<(int) fails to call width(0) on exception

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2, 4.1.3
    • Fix Version/s: 4.2.0
    • Component/s: 27. Input/Output
    • Labels:
      None
    • Environment:

      all

      Description

      lib.facet.num.put.virtuals, p5, Stage 3 is specified to end by the facet calling width(0) before outputting any characters using the facet's iterator. The program below shows that stdcxx fails to do so:

      $ cat t.cpp && nice gmake t && ./t
      #include <cassert>
      #include <ostream>
      #include <streambuf>

      int main ()
      {
      struct: std::streambuf {
      int_type overflow (int_type)

      { return throw this, traits_type::eof (); }

      } buf;

      std::ostream out (&buf);
      out.width (2);

      try

      { out << 1; }

      catch (...) { }
      assert (0 == out.width ());
      }
      aCC -c -I/nfs/devco/sebor/dev/stdlib/include/ansi -I/usr/include -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/nfs/devco/sebor/dev/stdlib/include -I/build/sebor/aCC-3.27-11s/include -I/nfs/devco/sebor/dev/stdlib/examples/include -Aa +nostl -g +d +w +W392 +W655 +W684 +W818 +W819 +W849 +W229 +W361 t.cpp
      aCC t.o -o t -Aa +nostl -Wl,+s -Wl,+vnocompatwarnings -L/build/sebor/aCC-3.27-11s/lib -L/build/sebor/aCC-3.27-11s/lib -lstd11s -lm
      Assertion failed: 0 == out.width (), file t.cpp, line 20
      ABORT instruction (core dumped)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: