Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


1138. Rvalue-ness check for rvalue reference binding is wrong

Section:9.5.4  [dcl.init.ref]    Status:C++11    Submitter:US    Date:2010-08-02

[Voted into the WP at the November, 2010 meeting.]

N3092 comment US 48
N3092 comment GB 37
N3092 comment DE 10

The requirement that an rvalue reference must be bound to an rvalueis found in 9.5.4 [dcl.init.ref] bullet 5.2:

This is not quite correct, as it is phrased in terms of the valuecategory of the initializer expression itself rather than that ofthe result of any conversions applied to the initializer. It shouldbe permitted to bind an rvalue reference to a temporary created froman lvalue, for instance, or to the rvalue result of a conversionfunction for an lvalue object of class type. Also, it shouldnotbe permitted to bind an rvalue reference to the lvalue result of aconversion function for a class rvalue.

Proposed resolution (August, 2010):

Change 9.5.4 [dcl.init.ref] paragraph 5 as follows:

A reference to type “cv1T1”is initialized by an expression of type “cv2T2” as follows:

In all cases except the last (i.e., creating andinitializing a temporary from the initializer expression),the reference is said tobind directly to theinitializer expression.

This resolution also resolvesissue 1139.




[8]ページ先頭

©2009-2026 Movatter.jp