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

2024-12-19


2849. Parameter objects are not temporary objects

Section: 6.7.7  [class.temporary]     Status: DRWP     Submitter: Brian Bi     Date: 2024-01-20

[Accepted as a DR at the March, 2024 meeting.]

(From submission #490.)

Parameter objects are not temporary objects, according to 6.7.7 [class.temporary] paragraph 1. An exception hinting at this in 6.7.7 [class.temporary] paragraph 7 should be removed.

Proposed resolution (approved by CWG 2024-02-02):

Change in 6.7.7 [class.temporary] paragraph 7 as follows:

The fourth context is when a temporary object other than a function parameter object is created in the for-range-initializer of a range-based for statement. If such a temporary object would otherwise be destroyed at the end of the for-range-initializer full-expression, the object persists for the lifetime of the reference initialized by the for-range-initializer.