This paper presents the proposed wording to resolve core issue 1299. The drafting below also addresses core issues 943 and 1076.
... [ Note: If the expression is an lvalue of class type, it must have a volatile copy constructor to initialize the temporary that is the result object of the lvalue-to-rvalue conversion. -- end note ] ...Change in 15.2 class.temporary paragraph 6:
The third context is when a reference is bound to a temporary . [ Footnote: The same rules apply to initialization of an initializer_list object (8.6.4) with its underlying temporary array. ] The temporary to which the reference is bound or the temporary that is the complete object of a subobject to which the reference is bound persists for the lifetime of the referenceChange in 126.96.36.199 over.match.copy paragraph 1:
- A temporary object bound to a reference parameter in a function call (8.2.2) persists until the completion of the full-expression containing the call.
- The lifetime of a temporary bound to the returned value in a function return statement (9.6.3) is not extended; the temporary is destroyed at the end of the full-expression in the return statement.
- A temporary bound to a reference in a new-initializer (8.3.4) persists until the completion of the full-expression containing the new-initializer. [ Example: ...]
Change in 188.8.131.52 res.on.arguments paragraph 1:
- When the type of the initializer expression is a class type "cv S", the non-explicit conversion functions of S and its base classes are considered. When initializing a temporary to be bound to the first parameter of a constructor that takes a reference to possibly cv-qualified T as its first argument, called with a single argument in the context of direct-initialization of an object of type "cv2 T", explicit conversion functions are also considered. ...
Change in 184.108.40.206.3 util.smartptr.weak.assign paragraph 2:
- .. [ Note: If a program casts an lvalue to an xvalue while passing that lvalue to a library function (e.g. by calling the function with the argument
move(x)), the program is effectively asking that function to treat that lvalue as a temporary . The implementation is free to optimize away aliasing checks which might be needed if the argument was an lvalue. -- end note ]
Remarks: The implementation may meet the effects (and the implied guarantees) via different means, without creating a temporary .Change in 220.127.116.11 template.valarray.overview paragraph 1:
... The illusion of higher dimensionality may be produced by the familiar idiom of computed indices, together with the powerful subsetting capabilities provided by the generalized subscript operators. [ Footnote: The intent is to specify an array template that has the minimum functionality necessary to address aliasing ambiguities and the proliferation ofChange in C.2.16 diff.cpp03.input.output:
temporaries. Thus, the valarray template is neither a matrix class nor a field class. However, it is a very useful building block for designing such classes. ]
[ ... ] a const_cast, static_cast, dynamic_cast, or reinterpret_cast converting, without a user-defined conversion, a glvalue operand that is one of these expressions to a glvalue that refers to the object designated by the operand, or to its complete object or a subobject thereof, [ ... ] For (c) above, I suggest: [ ... ] if the glvalue to which the reference is bound was obtained through one of the following: [ ... ]
- initializing a const bool& which would bind to a temporary .