C++ Logo

std-discussion

Advanced search

Re: Wording Includes Normal Use Case

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Thu, 23 Nov 2023 22:25:26 +0100
On 23/11/2023 21.50, Brian Bi wrote:
>
>
> On Thu, Nov 23, 2023 at 2:43 PM Jens Maurer via Std-Discussion <std-discussion_at_[hidden] <mailto:std-discussion_at_[hidden]>> wrote:
>
>
> On 23/11/2023 19.42, Daniel Markus via Std-Discussion wrote:
> > Maybe I'm picky and probably everyone understands what is meant, but
> > what's said right now is that the (an) other object occupies its own
> > storage location, which is the normal use case.
>
> There is half a sentence in front that talks about ending the lifetime
> prior to the implicit destructor call, and there is an example that follows.
>
> What exactly is unclear here?
>
>
> I think the issue is that the normative wording is not clear about the temporal relationship, i.e., that the UB only occurs if the ending of the lifetime (without subsequent recreation of an object of the same time) happens /before/ the implicit destructor call---as opposed to when you do nothing and just let the implicit destructor call take place (in which case the ending of the lifetime occurs at the same time as the implicit destructor call, because the start of the implicit destructor call ends the lifetime).

Aha. Maybe we want to make this a note and rely on [stmt.dcl] p2
and [basic.life] p7.2 instead?

Jens

Received on 2023-11-23 21:25:31