http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53841
Richard Smith <richard-gccbugzilla at metafoo dot co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |richard-gccbugzilla at
| |metafoo dot co.uk
--- Comment #3 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk>
2012-11-14 23:06:07 UTC ---
This code has more problems with duration conversions:
// DR 887 - Sync unknown clock to known clock.
const typename _Clock::time_point __c_entry = _Clock::now();
const __clock_t::time_point __s_entry = __clock_t::now();
const chrono::nanoseconds __delta = __atime - __c_entry;
const __clock_t::time_point __s_atime = __s_entry + __delta;
The last line attempts to implicitly convert from time_point<[...],
nanoseconds> to system_clock::time_point, which may be in microseconds or even
in seconds.
Suggested fix:
- const chrono::nanoseconds __delta = __atime - __c_entry;
- const __clock_t::time_point __s_atime = __s_entry + __delta;
+ const auto __delta = __atime - __c_entry;
+ const auto __s_atime = __s_entry + __delta;
Clang trunk currently rejects this code (prior to instantiation, even) due to
this invalid conversion if _GLIBCXX_USE_CLOCK_REALTIME is not defined (as seems
to be the case on several popular linux distributions).