Ticket #8691: chrono_duration_get_bug_8691.patch

File chrono_duration_get_bug_8691.patch, 1.7 KB (added by tmmikolajczyk@…, 9 years ago)
  • boost/chrono/io/duration_get.hpp

    diff --git boost/chrono/io/duration_get.hpp boost/chrono/io/duration_get.hpp
    index 6014603..938cb73 100644
    namespace boost  
    467467       * translation in other contexts, as e.g. days and weeks.
    468468       *
    469469       * @param facet the duration_units facet
    470        * @param s start input stream iterator.
     470       * @param i start input stream iterator.
    471471       * @param e end input stream iterator.
    472472       * @param ios a reference to a ios_base.
    473473       * @param err the ios_base state.
    namespace boost  
    484484        const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end,
    485485        //~ std::use_facet<std::ctype<CharT> >(loc),
    486486            err);
     487        if (err & (std::ios_base::badbit | std::ios_base::failbit))
     488        {
     489          return i;
     490        }
    487491        if (!facet.match_n_d_valid_unit(k))
    488492        {
    489493          err |= std::ios_base::failbit;
    namespace boost  
    499503       * translation in other contexts, as e.g. days and weeks.
    500504       *
    501505       * @param facet the duration_units facet
    502        * @param s start input stream iterator.
     506       * @param i start input stream iterator.
    503507       * @param e end input stream iterator.
    504508       * @param ios a reference to a ios_base.
    505509       * @param err the ios_base state.
    namespace boost  
    519523        const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end,
    520524        //~ std::use_facet<std::ctype<CharT> >(loc),
    521525            err);
    522 
     526        if (err & (std::ios_base::badbit | std::ios_base::failbit))
     527        {
     528          return i;
     529        }
    523530        if (!facet.match_valid_unit(k, rt))
    524531        {
    525532          err |= std::ios_base::failbit;