This seems to be a bug in the GCC implementation of the <chrono> library, as @Aaron McDaid suggested. There is a (currently unconfirmed) error report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69905
GCC libstdC ++ implements two signatures for std::chrono_literals :
constexpr chrono::duration<long double> operator""s(long double __secs) { return chrono::duration<long double>{__secs}; } template <char... _Digits> constexpr chrono::seconds operator""s() { return __check_overflow<chrono::seconds, _Digits...>(); }
The version of the template giving the error is not required by the standard. When adding
constexpr chrono::seconds operator""s(unsigned long long __secs) { return chrono::seconds{__secs}; }
in the <chrono> (my local installation) header, the error disappears.
However, developers of GCC libraries may specifically refuse this version, so they can prevent unsigned unsigned conversions to signatures, since seconds are defined as
typedef duration<int64_t> seconds;
Edit:
As Jonathan Wakeli recently noted in the comments on the bug report, the implementation was chosen by the project in connection with the task of the library working group , but does not take into account the delimiters of numbers.
René Richter Oct 26 '16 at 2:33 p.m. 2016-10-26 14:33
source share