You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The standard is vague on the storage duration of temporary objects, as Nicol Bolas explained on Stack Overflow:
[basic.stc]/1 tells us:
The storage duration is the property of an object that defines the minimum potential lifetime of the storage containing the object.
So every object has a storage duration. Further, paragraph 2 says:
Static, thread, and automatic storage durations are associated with objects introduced by declarations (6.1) and implicitly created by the implementation (15.2).
Emphasis added. Note that section 15.2 is [class.temporary]: the rules for temporary objects.
Therefore, we can conclude that temporary objects have storage durations. And we can conclude that temporaries must have one of those storage durations. Indeed, there are numerous references in the standard to "variables or temporary objects" and their storage durations.
However, despite this clearly saying that temporary objects have one of those storage durations... the standard never actually says what storage duration they have. [class.temporary] does not have a statement saying that temporaries bound to references have the storage duration of their references. And [basic.stc]'s explanation of static, automatic, and thread-local durations always speaks of variables.
So I would say that this is a defect in the wording. It seems clear that the standard expects temporaries to have an appropriate storage duration; there are multiple places where the standard talks about the storage duration of variable or temporary objects. But it never says what storage duration they actually have.
So could we improve the situation?
The text was updated successfully, but these errors were encountered:
The standard is vague on the storage duration of temporary objects, as Nicol Bolas explained on Stack Overflow:
So could we improve the situation?
The text was updated successfully, but these errors were encountered: