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


2226. Xvalues vs lvalues in conditional expressions

Section:7.6.16  [expr.cond]    Status:CD5    Submitter:Richard Smith    Date:2016-02-01

[Accepted as a DR at the March, 2018 (Jacksonville) meeting.]

In the following example,

   const T a;   T b;   false ? a : std::move(b);

the most appropriate result would seem to be that the expression isan lvalue of typeconst T that refers to eithera orb. However, because 7.6.16 [expr.cond] bullet 4.1requires that the conversion bind directly to an lvalue, whilestd::move(b) is an xvalue, the result is aconst Ttemporary copy-initialized fromstd::move(b).

Proposed resolution (November, 2017)

Change 7.6.16 [expr.cond] bullet 4.1 as follows:

Attempts are made to form an implicit conversion sequence from anoperand expressionE1 of typeT1 to a target type relatedto the typeT2 of the operand expressionE2 asfollows:




[8]ページ先頭

©2009-2026 Movatter.jp