Opened 13 years ago

Closed 5 years ago

#3608 closed Bugs (worksforme)

run time warning in vc9 when parsing ptime (with patch)

Reported by: anonymous Owned by: James E. King, III
Milestone: Boost 1.41.0 Component: date_time
Version: Boost 1.40.0 Severity: Problem
Keywords: Cc:

Description

run time warning(loss of precision when converting between types) in vc9 (with run time checks enabled) when parsing ptime with year format

reproduceable testcase: parse "20090101" with facet "%Y-%m-%dT%H:%M:%S%F" makes vc stop execution to notify of mismatch.

the patch: sets the local variable to unsigned int (instead of unsigned short)

Attachments (1)

boost-date_time-parse_ptrime_runtime_type_mismatch.patch (452 bytes ) - added by Thomas.Lemm@… 13 years ago.
the patch

Download all attachments as: .zip

Change History (3)

by Thomas.Lemm@…, 13 years ago

the patch

comment:1 by James E. King, III, 5 years ago

Owner: changed from az_sw_dude to James E. King, III

comment:2 by James E. King, III, 5 years ago

Resolution: worksforme
Status: newclosed

As of 1.66.0 I cannot reproduce this issue. I added this test to testtime_input_facet.cpp (at the end):

  // trac-3608 (https://svn.boost.org/trac10/ticket/3608)
  {
      const std::string value = "20090101";
      boost::posix_time::time_input_facet* facet5 = new boost::posix_time::time_input_facet("%Y-%m-%dT%H:%M:%S%F");
      boost::posix_time::ptime ptx;
      check("trac 3608 /RTC no failbit set", !failure_test(ptx, value, facet5)); // proves failbit was not set
      check_equal("trac 3608 /RTC valid value", "2009-10-01T00:00:00", to_iso_extended_string(ptx));
  }

Built with -RTC1 and msvc-14.1 and no errors reported.

Note: See TracTickets for help on using tickets.