Title
Rvalue references and function viability
Status
cd2
Section
12.2.4.2.5 [over.ics.ref]
Submitter
Mike Miller

Created on 2009-08-18.00:00:00 last changed 143 months ago

Messages

Date: 2010-03-15.00:00:00

[Voted into WP at March, 2010 meeting.]

Date: 2009-11-15.00:00:00

Proposed resolution (November, 2009):

Change 12.2.4.2.5 [over.ics.ref] paragraph 3 as follows:

A Except for an implicit object parameter, for which see 12.2.2 [over.match.funcs], a standard conversion sequence cannot be formed if it requires binding an lvalue reference to non-const to an rvalue (except when binding an implicit object parameter; see the special rules for that case in 12.2.2 [over.match.funcs]) or binding an rvalue reference to an lvalue. [Note: this means, for example, that a candidate function cannot be a viable function if it has a non-const lvalue reference parameter (other than the implicit object parameter) and the corresponding argument is a temporary or would require one to be created to initialize the lvalue reference (see 9.4.4 [dcl.init.ref]). —end note]
Date: 2009-08-18.00:00:00

According to 12.2.4.2.5 [over.ics.ref] paragraphs 3-4,

A standard conversion sequence cannot be formed if it requires binding an lvalue reference to non-const to an rvalue (except when binding an implicit object parameter; see the special rules for that case in 12.2.2 [over.match.funcs]). [Note: this means, for example, that a candidate function cannot be a viable function if it has a non-const lvalue reference parameter (other than the implicit object parameter) and the corresponding argument is a temporary or would require one to be created to initialize the lvalue reference (see 9.4.4 [dcl.init.ref]). —end note]

Other restrictions on binding a reference to a particular argument that are not based on the types of the reference and the argument do not affect the formation of a standard conversion sequence, however.

Because this section does not mention attempting to bind an rvalue reference to an lvalue, such a “conversion sequence” might be selected as best and result in an ill-formed program. It should, instead, be treated like trying to bind an lvalue reference to non-const to an rvalue, making the function non-viable.

History
Date User Action Args
2010-03-29 00:00:00adminsetmessages: + msg2726
2010-03-29 00:00:00adminsetstatus: tentatively ready -> cd2
2010-02-16 00:00:00adminsetmessages: + msg2507
2010-02-16 00:00:00adminsetstatus: drafting -> tentatively ready
2009-11-08 00:00:00adminsetstatus: open -> drafting
2009-08-18 00:00:00admincreate