|
4317 | 4317 | \pnum
|
4318 | 4318 | \indextext{initializer!temporary and declarator}%
|
4319 | 4319 | \indextext{temporary!order of destruction of}%
|
4320 |
| -There are three contexts in which temporaries are destroyed at a different |
| 4320 | +There are four contexts in which temporaries are destroyed at a different |
4321 | 4321 | point than the end of the full-expression.
|
4322 | 4322 | The first context is when a default constructor is called to initialize
|
4323 | 4323 | an element of an array with no corresponding initializer\iref{dcl.init}.
|
|
4438 | 4438 | \end{itemize}
|
4439 | 4439 |
|
4440 | 4440 | \pnum
|
4441 |
| -The destruction of a temporary whose lifetime is not extended by being |
4442 |
| -bound to a reference is sequenced before the destruction of every |
| 4441 | +The fourth context is when a temporary object other than a function parameter object |
| 4442 | +is created in the \grammarterm{for-range-initializer} of a range-based \keyword{for} statement. |
| 4443 | +If such a temporary object would otherwise be destroyed |
| 4444 | +at the end of the \grammarterm{for-range-initializer} full-expression, |
| 4445 | +the object persists for the lifetime of the reference |
| 4446 | +initialized by the \grammarterm{for-range-initializer}. |
| 4447 | + |
| 4448 | +\pnum |
| 4449 | +The destruction of a temporary whose lifetime is not extended |
| 4450 | +beyond the full-expression in which it was created |
| 4451 | +is sequenced before the destruction of every |
4443 | 4452 | temporary which is constructed earlier in the same full-expression.
|
4444 |
| -If the lifetime of two or more temporaries to which references are bound ends |
4445 |
| -at the same point, |
| 4453 | +If the lifetime of two or more temporaries |
| 4454 | +with lifetimes extending beyond the full-expressions in which they were created |
| 4455 | +ends at the same point, |
4446 | 4456 | these temporaries are destroyed at that point in the reverse order of the
|
4447 | 4457 | completion of their construction.
|
4448 |
| -In addition, the destruction of temporaries bound to references shall |
| 4458 | +In addition, the destruction of such temporaries shall |
4449 | 4459 | take into account the ordering of destruction of objects with static, thread, or
|
4450 | 4460 | automatic storage duration\iref{basic.stc.static,basic.stc.thread,basic.stc.auto};
|
4451 | 4461 | that is, if
|
|
0 commit comments