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

[MSVC] std::num_put bad formatting of 0.0 with precision and showpoint

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2, 4.1.3, 4.1.4, 4.2.0
    • Fix Version/s: 4.2.1
    • Component/s: 22. Localization
    • Labels:
      None
    • Environment:

      Windows/MSVC

    • Severity:
      Incorrect Behavior

      Description

      When compiled with MSVC (any version), the program below aborts at runtime.

       
      $ cat t.cpp && cl  -D_RWCONFIG=11s_msvc_7_1 -Ic:/contrib/cygwin/build/sebor/dev-hal/include -I./../../../../include -Ic:/contrib/cygwin/build/sebor/dev-hal/examples/stdlib/manual/../include  -Ic:/contrib/cygwin/build/sebor/dev-hal/include/ansi -I./../../../..
      -Ic:/contrib/cygwin/build/sebor/dev-hal -Ic:/contrib/cygwin/build/sebor/dev-hal/examples/stdlib/manual -I. -nologo -GX -MLd -W3 -Zi -GA -GR -GF -GZ  -c t.cpp && link  -nologo /NODEFAULTLIB:libcpd /debug /LIBPATH:./../../../../lib /OUT:t.exe t.obj  std11s_msvc_7_1.lib user32.lib t.cpp && ./t.exe
      
      #include <cassert>
      #include <sstream>
      
      int main ()
      {
          std::ostringstream strm;
      
          strm.setf (strm.showpoint);
          strm.precision (2);
      
          strm << 0.0;
      
          assert ("0.0" == strm.str ());
      }
      
      Assertion failed: "0.0" == strm.str (), file t.cpp, line 13
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4h
                  4h
                  Remaining:
                  Time Spent - 2.5h Remaining Estimate - 1.5h
                  1.5h
                  Logged:
                  Time Spent - 2.5h Remaining Estimate - 1.5h
                  2.5h