3225. zoned_time converting constructor shall not be noexcept

Section: 30.11.7.2 [time.zone.zonedtime.ctor] Status: C++20 Submitter: Tomasz Kamiński Opened: 2019-06-20 Last modified: 2021-02-25

Priority: 0

View all other issues in [time.zone.zonedtime.ctor].

View all issues with C++20 status.

Discussion:

The zoned_time constructor from zoned_time<Duration2, TimeZonePtr> (preserving same time zone, different precision of representation) is currently marked noexcept. Given that the exposition-only member tp_ of type sys_time<duration> has essentially type time_point<system_clock, Duration>, this is incompatible with the invoked time_point constructor, which is not marked as noexcept.

[2019-07 Issue Prioritization]

Status to Tentatively Ready after five positive votes on the reflector.

Proposed resolution:

This wording is relative to N4820.

  1. Modify 30.11.7.1 [time.zone.zonedtime.overview], class template zoned_time synopsis, as indicated:

    template<class Duration2>
      zoned_time(const zoned_time<Duration2, TimeZonePtr>& zt) noexcept;
    
  2. Modify 30.11.7.2 [time.zone.zonedtime.ctor] as indicated:

    template<class Duration2>
      zoned_time(const zoned_time<Duration2, TimeZonePtr>& y) noexcept;
    

    -9- Requires: Does not participate in overload resolution unless sys_time<Duration2> is implicitly convertible to sys_time<Duration>.

    -10- Effects: Constructs a zoned_time by initializing zone_ with y.zone_ and tp_ with y.tp_.