This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


2919. Conversion function candidates for initialization of const lvalue reference

Section: 12.2.2.7  [over.match.ref]     Status: tentatively ready     Submitter: Brian Bi     Date: 2024-07-18

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.

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 for any T2.