This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

3414. [networking.ts] service_already_exists has no usable constructors

Section: 13.7 [networking.ts::async.exec.ctx] Status: WP Submitter: Jonathan Wakely Opened: 2020-03-17 Last modified: 2020-11-09

Priority: 0

View all issues with WP status.

Discussion:

Addresses: networking.ts

In the Networking TS, the service_already_exists exception type has no constructors declared. The logic_error base class is not default constructible, so service_already_exists's implicit default constructor is defined as deleted.

Implementations can add one or more private constructors that can be used by make_service, but there seems to be little benefit to that. The Boost.Asio type of the same name has a public default constructor.

[2020-04-18 Issue Prioritization]

Status set to Tentatively Ready after six positive votes on the reflector.

[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]

Proposed resolution:

This wording is relative to N4734.

  1. Modify 13.7 [networking.ts::async.exec.ctx] p1, as indicated:

    // service access
    template<class Service> typename Service::key_type&
    use_service(execution_context& ctx);
    template<class Service, class... Args> Service&
    make_service(execution_context& ctx, Args&&... args);
    template<class Service> bool has_service(const execution_context& ctx) noexcept;
    class service_already_exists : public logic_error { };
    {
    public:
      service_already_exists();
    };
    
  2. Add a new subclause after [async.exec.ctx.globals]:

    13.7.6 Class service_already_exists [async.exec.ctx.except]

    -1- The class service_already_exists defines the type of objects thrown as exceptions to report an attempt to add an existing service to an execution_context.

    service_already_exists();
    

    -2- Postconditions: what() returns an implementation-defined NTBS.