Talk:cpp/language/reference initialization

Sentence "Otherwise, if the reference is an lvalue reference: If object is an lvalue expression, and its type is T or derived from T, and is equally or less cv-qualified, then the reference is bound to the object identified by the lvalue or to its base class subobject." should be editted to express rvalue reference. someone please update this.
 * this section is covering https://eel.is/c++draft/dcl.init.ref#5.1 which talks about lvalue references. rvalue reference init is discussed in the next bullet point --Cubbi (talk) 07:34, 24 September 2020 (PDT)

What about initializing a non-static class member of reference type? Is that also reference initialization, and if so, does this page need extending?
 * good catch, I think it should be here even if I am not finding anything specific about references in 12.6.2 (it only talks of member subobjects, which reference members are not) --Cubbi (talk) 06:58, 16 June 2015 (PDT)
 * added. --Cubbi (talk) 06:56, 2 July 2015 (PDT)

I am wondering about the lifetime extension exception case:


 * a temporary bound to a return value of a function in a return statement is not extended: it is destroyed immediately at the end of the return expression. Such function always returns a dangling reference.

I suppose that an example might be:

std::string && foo { return std::string("bar"); }

Tmcleod (talk) 13:27, 25 April 2016 (PDT)