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

2023-01-15


1572. Incorrect example for rvalue reference binding via conversion function

Section: 9.4.4  [dcl.init.ref]     Status: CD4     Submitter: Michael Wong     Date: 2012-10-15

[Moved to DR at the November, 2014 meeting.]

The example just before the final bullet of 9.4.5 [dcl.init.list] paragraph 5 is incorrect. It reads, in part,

  struct X {
    operator int&();
  } x;
  int&& rri2 = X(); // error: lvalue-to-rvalue conversion applied to the
                    // result of operator int&

In fact, according to 12.2.2.7 [over.match.ref] (as clarified by the proposed resolution of issue 1328, although the intent was arguably the same for the previous wording), X::operator int&() is not a candidate for the initialization of rri2, so the case falls into the last bullet, creating an int temporary.

It is not clear whether the lvalue-to-rvalue conversion whose prohibition is intended to be illustrated by that example could actually occur, given the specification of candidate functions in 12.2.2.7 [over.match.ref].

Proposed resolution (February, 2014):

This issue is resolved by the resolution of issue 1571.