E2559 Can't initialize rvalue reference of type '%s' with lvalue of type '%s' (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

This error message occurs when attempting to bind an lvalue to an rvalue reference. When converting to an rvalue reference type, the source must not be an lvalue (such as a named variable) or an rvalue reference to a function type.

Example:

    A&  a_ref3 = A();  // Error!
    A&& a_ref4 = A();  // Ok