Title
Conversion function candidates for initialization of const lvalue reference
Status
tentatively ready
Section
12.2.2.7 [over.match.ref]
Submitter
Brian Bi

Created on 2024-07-18.00:00:00 last changed 2 months ago

Messages

Date: 2024-08-16.19:45:15

Proposed resolution (approved by CWG 2024-08-16):

Change in 12.2.2.7 [over.match.ref] bullet 1.1 as follows:

Let R be a set of types including
  • “lvalue reference to cv2 T2” (when initializing converting to an lvalue reference or an rvalue reference to function) and
  • “cv2 T2” and “rvalue reference to cv2 T2” (when initializing converting to an rvalue reference or an lvalue reference to of function type)
for any T2.
Date: 2024-07-18.00:00:00

There is implementation divergence handling the following example:

  struct A {
    A(const A&) = delete;
  };
  struct B {
    operator A&&();
  };
  const A& r = B();

Conversion to an lvalue pursuant to 9.4.4 [dcl.init.ref] bullet 5.1 fails due to the attempt to invoke a deleted function, but conversion to an rvalue according to 9.4.4 [dcl.init.ref] bullet 5.3 would succeed, except that 12.2.2.7 [over.match.ref] bullet 1.1 hinges on the target type of the initialization, not the target type of the conversion.

History
Date User Action Args
2024-08-16 19:45:15adminsetstatus: open -> tentatively ready
2024-08-02 11:50:11adminsetmessages: + msg7784
2024-07-18 00:00:00admincreate