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

3445. [networking.ts] net::basic_socket_istream::connect should be constrained

Section: 19.2.1 [networking.ts::socket.iostream.cons], 19.2.2 [networking.ts::socket.iostream.members] Status: LEWG Submitter: Jonathan Wakely Opened: 2020-05-14 Last modified: 2021-05-10

Priority: 3

View all other issues in [networking.ts::socket.iostream.cons].

View all issues with LEWG status.

Discussion:

Addresses: networking.ts

basic_socket_streambuf<P, C, W>::connect(Args&&...) is constrained to only exist when P meets the InternetProtocol requirements, but basic_socket_iostream<P, C, W>::connect(Args&&...) is not constrained. Since it just passes those arguments straight to the streambuf, the outer connect(Args&&...) should be constrained too.

In addition to that, the basic_socket_iostream(Args&&...) constructor should be constrained, so that is_constructible gives the right answer.

[2020-07-17; Priority set to 3 in telecon]

Proposed resolution:

This wording is relative to N4771.

  1. Modify 19.2.1 [networking.ts::socket.iostream.cons] as indicated:

    [Drafting note: As a drive-by fix, a missing std:: qualification in front of forward has been added]

    template<class... Args>
      explicit basic_socket_iostream(Args&&... args);
    

    -4- Effects: Initializes the base class as basic_iostream<char>(&sb_)), value-initializes sb_, and performs setf(std::ios_base::unitbuf). Then calls rdbuf()->connect(std::forward<Args>(args)...). If that function returns a null pointer, calls setstate(failbit).

    -?- Remarks: This function shall not participate in overload resolution unless the expression rdbuf()->connect(std::forward<Args>(args)...) is well-formed.

  2. Modify 19.2.2 [networking.ts::socket.iostream.members] as indicated:

    [Drafting note: As a drive-by fix, a missing std:: qualification in front of forward has been added]

    template<class... Args>
      void connect(Args&&... args);
    

    -1- Effects: Calls rdbuf()->connect(std::forward<Args>(args)...). If that function returns a null pointer, calls setstate(failbit) (which may throw ios_base::failure).

    -?- Remarks: This function shall not participate in overload resolution unless the expression rdbuf()->connect(std::forward<Args>(args)...) is well-formed.