Skip to content

Commit 89223a8

Browse files
still check for specialization
1 parent 4a01d77 commit 89223a8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

libcxx/include/__chrono/is_clock.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ class duration;
3232
template <class _Clock, class _Duration>
3333
class time_point;
3434

35+
// Helper to check that _Tp::time_point has the form time_point<_, typename _Tp::duration>.
36+
template <class _TimePoint, class _ClockType>
37+
constexpr bool __is_valid_clock_time_point_v = false;
38+
39+
template <class _TimePointClock, class _ClockType>
40+
constexpr bool __is_valid_clock_time_point_v<time_point<_TimePointClock, typename _ClockType::duration>, _ClockType> =
41+
true;
42+
3543
// Check if a clock satisfies the Cpp17Clock requirements as defined in [time.clock.req]
3644
template <class _Tp>
3745
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_clock_v = requires {
@@ -45,7 +53,7 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_clock_v = requires {
4553
requires _IsSame<typename _Tp::duration, duration<typename _Tp::rep, typename _Tp::period>>::value;
4654

4755
typename _Tp::time_point;
48-
requires _IsSame<typename _Tp::time_point::duration, typename _Tp::duration>::value;
56+
requires __is_valid_clock_time_point_v<typename _Tp::time_point, _Tp>;
4957

5058
_Tp::is_steady;
5159
requires _IsSame<decltype(_Tp::is_steady), const bool>::value;

0 commit comments

Comments
 (0)