================ @@ -76,12 +81,71 @@ class zoned_time { _LIBCPP_HIDE_FROM_ABI explicit zoned_time(string_view __name) requires(requires { __traits::locate_zone(string_view{}); } && - // constructible_from<zoned_time, decltype(__traits::locate_zone(string_view{}))> - // would create a dependency on itself. Instead depend on the fact - // a constructor taking a _TimeZonePtr exists. constructible_from<_TimeZonePtr, decltype(__traits::locate_zone(string_view{}))>) : __zone_{__traits::locate_zone(__name)}, __tp_{} {} + template <class _Duration2> + _LIBCPP_HIDE_FROM_ABI zoned_time(const zoned_time<_Duration2, _TimeZonePtr>& __zt) + requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>> + : __zone_{__zt.get_time_zone()}, __tp_{__zt.get_sys_time()} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const sys_time<_Duration>& __tp) + : __zone_{std::move(__zone)}, __tp_{__tp} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const sys_time<_Duration>& __tp) + requires requires { _TimeZonePtr{__traits::locate_zone(string_view{})}; } + : zoned_time{__traits::locate_zone(__name), __tp} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const local_time<_Duration>& __tp) + requires(is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})), + sys_time<duration>>) + : __zone_{std::move(__zone)}, __tp_{__zone_->to_sys(__tp)} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const local_time<_Duration>& __tp) + requires(requires { + _TimeZonePtr{__traits::locate_zone(string_view{})}; + } && is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})), ---------------- ldionne wrote:
```suggestion requires is_constructible<zoned_time, decltype(__traits::locate_zone(__name))> && is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})), ``` The constraint in http://eel.is/c++draft/time.zone#zonedtime.ctor-18.sentence-1 is: > Constraints: zoned_time is constructible from the return type of > `traits::locate_zone(name)` and `tp`. https://github.com/llvm/llvm-project/pull/95010 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits