Re: [Boost-bugs] [Boost C++ Libraries] #13280: "20170101" gives surprising result parsed as extended ISO 8601

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13280: "20170101" gives surprising result parsed as extended ISO 8601
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-12-21 16:06:35


#13280: "20170101" gives surprising result parsed as extended ISO 8601
--------------------------------------------+------------------------------
  Reporter: Thomas Guest <thomas.guest@…> | Owner: James E. King,
                                            | III
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: date_time
   Version: Boost 1.65.0 | Severity: Problem
Resolution: worksforme | Keywords:
--------------------------------------------+------------------------------
Changes (by James E. King, III):

 * status: new => closed
 * resolution: => worksforme

Comment:

 I just added this test to testdate_input_facet and using Boost 1.66.0 with
 msvc-14.1 it works properly. You did not enable exceptions in your
 example. Before calling imbue, you want to call:

 {{{
     ss.exceptions(std::ios_base::failbit); // turn on exceptions
 }}}

 if you want an exception to be raised.

 Example (add this to the testdate_input_facet unit test to see it work):
 {{{
   // prove trac 13280 on extended iso format is behaving properly
   {
     std::string value = "20171221";
     date_input_facet *f13280_bad = new date_input_facet();
     f13280_bad->set_iso_extended_format();
     std::stringstream s13280_bad;
     s13280_bad.imbue(std::locale(s13280_bad.getloc(), f13280_bad));
     s13280_bad << value;
     boost::gregorian::date d13280_bad;
     check("extended ISO with YYYYMMDD sets failbit",
           failure_test(d13280_bad, value, f13280_bad));
     check("extended iso with YYYYMMDD is not a date",
           d13280_bad.is_not_a_date());
   }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13280#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-12-21 16:18:25 UTC