Created on 2004-02-21.00:00:00 last changed 196 months ago
[Voted into WP at April, 2006 meeting.]
Proposed resolution (October, 2005):
Change 6.7.7 [class.temporary] paragraph 5 as follows:
... In addition, the destruction of temporaries bound to references shall take into account the ordering of destruction of objects with static or automatic storage duration (6.7.5.2 [basic.stc.static], 6.7.5.4 [basic.stc.auto]); that is, if obj1 is an objectwith static or automatic storage durationcreated before the temporary is created with the same storage duration as the temporary, the temporary shall be destroyed before obj1 is destroyed; if obj2 is an objectwith static or automatic storage durationcreated after the temporary is created with the same storage duration as the temporary, the temporary shall be destroyed after obj2 is destroyed...
Notes from October 2004 meeting:
We agreed with Steve Adamczyk's suggestion.
Section 6.7.7 [class.temporary] paragraph 5 ends with this "rule":
For the temporary to be destroyed after obj2 is destroyed, when obj2 has static storage, I would say that the reference to the temporary should also have static storage, but that is IMHO not clear from the paragraph.
Example:
void f () { const T1& ref = T1(); static T2 obj2; ... }
Here the temporary would be destoyed before obj2, contrary to the rule above.
Steve Adamczyk: I agree there's a minor issue here. I think the clause quoted above meant for obj1 and obj2 to have the same storage duration. Replacing "obj2 is an object with static or automatic storage duration" by "obj2 is an object with the same storage duration as obj1" would, I believe, fix the problem.
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
2006-11-05 00:00:00 | admin | set | status: dr -> wp |
2006-04-22 00:00:00 | admin | set | messages: + msg1365 |
2006-04-22 00:00:00 | admin | set | status: ready -> dr |
2005-10-22 00:00:00 | admin | set | status: review -> ready |
2005-05-01 00:00:00 | admin | set | messages: + msg1148 |
2005-05-01 00:00:00 | admin | set | status: drafting -> review |
2004-11-07 00:00:00 | admin | set | messages: + msg1078 |
2004-11-07 00:00:00 | admin | set | status: open -> drafting |
2004-02-21 00:00:00 | admin | create |