[Bug libstdc++/61166] overflow when parse number in std::duration operator""

kan.liu.229 at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri May 16 07:32:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61166

--- Comment #12 from Kan Liu <kan.liu.229 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #11)
> (In reply to Kan Liu from comment #10)
> > _Select_type already does the overflow check, so *template implemented
> > operators* is still redundant I think.
> 
> You can't use _Select_type on a literal operator that is not a template.
> 
> > Since the standard units (std::hours,
> > milliseconds ...) requires the duration::rep to be *int64_t*,
> 
> No it doesn't, only chrono::nanoseconds is required to have a 64-bit
> representation. chrono::hours and chrono::minutes are allowed to have fewer
> than 32 bits ("at least 23 bits" and "at least 29 bits" respectively).
> 
> > there's no
> > need to do too much check.
> 
> Not all values of uint64_t fit in int64_t

Wow... I see



More information about the Gcc-bugs mailing list