On Friday 11 September 2020 at 19:59:36 +0100, Jonathan Wakely wrote: > commit 53ad6b1979f4bd7121e977c4a44151b14d8a0147 > Author: Jonathan Wakely > Date: Fri Sep 11 19:59:11 2020 > > libstdc++: Fix chrono::__detail::ceil to work with C++11 > > In C++11 constexpr functions can only have a return statement, so we > need to fix __detail::ceil to make it valid in C++11. This can be done > by moving the comparison and increment into a new function, __ceil_impl, > and calling that with the result of the duration_cast. > > This would mean the standard C++17 std::chrono::ceil function would make > two further calls, which would add too much overhead when not inlined. > For C++17 and later use a using-declaration to add chrono::ceil to > namespace __detail. For C++11 and C++14 define chrono::__detail::__ceil > as a C++11-compatible constexpr function template. > > > libstdc++-v3/ChangeLog: > > * include/std/chrono [C++17] (chrono::__detail::ceil): Add > using declaration to make chrono::ceil available for internal > use with a consistent name. > (chrono::__detail::__ceil_impl): New function template. > (chrono::__detail::ceil): Use __ceil_impl to compare and > increment the value. Remove SFINAE constraint. This change introduces a new implementation of ceil that, as far as I can tell, has no tests. A patch is attached to add the equivalent of the existing chrono::ceil tests for chrono::__detail::ceil. The tests fail to compile if I run them without 53ad6b1979f4bd7121e977c4a44151b14d8a0147 as expected due to the previous non-C++11-compliant implementation. Mike.