A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/CWG/issues/896.html below:

CWG Issue 896

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

2025-08-11

896. Rvalue references and rvalue-reference conversion functionsSection: 9.5.4  [dcl.init.ref]     Status: CD2     Submitter: Steve Adamczyk     Date: 9 May, 2009

[Voted into WP at October, 2009 meeting.]

Consider the following example:

    struct A { } a;
    struct B {
      operator A&&() {
        return static_cast<A&&>(a);
      }
    };
    A&& r = B();

One would expect that r would be bound to the object returned by B::operator A&&(), i.e., a. However, the logic in 9.5.4 [dcl.init.ref] paragraph 5 requires that the result of the conversion function be copied to a temporary and r bound to the temporary.

Probably the way to address this is to add another top-level bullet between the first and second that would essentially mimic the first bullet except dealing with rvalue references: direct binding to reference-compatible rvalues or to the reference-compatible result of a conversion function. (Note that this should only apply to class rvalues; the creation of a temporary for non-class rvalues is necessary to have an object for the reference to bind to.)

(See also issue 656.)

Proposed resolution (September, 2009):

This issue is resolved by the resolution of issue 656.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4