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

3629. make_error_code and make_error_condition are customization points

Section: 19.5 [syserr] Status: New Submitter: Jonathan Wakely Opened: 2021-10-31 Last modified: 2021-10-31

Priority: 2

View all other issues in [syserr].

View all issues with New status.

Discussion:

The rule in 16.4.2.2 [contents] means that the calls to make_error_code in 19.5.4.2 [syserr.errcode.constructors] and 19.5.4.3 [syserr.errcode.modifiers] are required to call std::make_error_code, which means program-defined error codes do not work. The same applies to the make_error_condition calls in 19.5.5.2 [syserr.errcondition.constructors] and 19.5.5.3 [syserr.errcondition.modifiers].

They need to use ADL. This is what all known implementations (including Boost.System) do.

[2022-01-29; Reflector poll]

Set priority to 2 after reflector poll.

Proposed resolution:

This wording is relative to N4901.

  1. Modify 19.5.2 [system.error.syn] as indicated:

    -1- The value of each enum errc constant shall be the same as the value of the <cerrno> macro shown in the above synopsis. Whether or not the <system_error> implementation exposes the <cerrno> macros is unspecified.

    -?- Invocations of make_error_code and make_error_condition shown in subclause 19.5 [syserr] select a function to call via overload resolution (12.2 [over.match]) on a candidate set that includes the lookup set found by argument dependent lookup (6.5.4 [basic.lookup.argdep]).

    -2- The is_error_code_enum and is_error_condition_enum templates may be specialized for program-defined types to indicate that such types are eligible for class error_code and class error_condition implicit conversions, respectively.

    [Note 1: Conversions from such types are done by program-defined overloads of make_error_code and make_error_condition, found by ADL. —end note]