Title
Incorrect example for rvalue reference binding via conversion function
Status
cd4
Section
9.4.4 [dcl.init.ref]
Submitter
Michael Wong

Created on 2012-10-15.00:00:00 last changed 95 months ago

Messages

Date: 2014-11-15.00:00:00

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

Date: 2014-02-15.00:00:00

Proposed resolution (February, 2014):

This issue is resolved by the resolution of issue 1571.

Date: 2012-10-15.00:00:00

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].

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5385
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-03-03 00:00:00adminsetmessages: + msg4835
2014-03-03 00:00:00adminsetstatus: drafting -> ready
2013-05-03 00:00:00adminsetstatus: open -> drafting
2012-10-15 00:00:00admincreate