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

Subject: [Boost-bugs] [Boost C++ Libraries] #13280: "20170101" gives surprising result parsed as extended ISO 8601
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-10-30 17:05:09


#13280: "20170101" gives surprising result parsed as extended ISO 8601
-------------------------------------------+------------------------
 Reporter: Thomas Guest <thomas.guest@…> | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.63.0 | Severity: Problem
 Keywords: |
-------------------------------------------+------------------------
 {{{
 #include <locale>
 #include <iostream>
 #include <sstream>
 #include <boost/date_time/gregorian/gregorian.hpp>

 int main()
 {
         std::string value = "20170105";

         boost::gregorian::date d;

         auto * f = new boost::gregorian::date_input_facet();
         f->set_iso_extended_format();

         std::stringstream ss;
         std::locale loc(std::locale::classic(), f);
         ss.imbue(loc);
         ss << value;
         ss >> d;

         std::cout << value << " => " << d << '\n';
         return 0;
 }
 }}}

 When I run this I get:

 20170105 => 2017-Oct-01

 I expected an exception to be raised.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13280>
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-10-30 17:11:39 UTC