C++ Logo

STD-DISCUSSION

Advanced search

Subject: CWG2256 resolution and [basic.life]/5
From: Language Lawyer (language.lawyer_at_[hidden])
Date: 2019-07-03 03:53:36


The resolution of CWG2256 changed wording in [basic.life]/1 from:

> The lifetime of an object o of type T ends when:
> — if T is a class type with a non-trivial destructor ([class.dtor]), the destructor call starts, or
> — the storage which the object occupies is released, or is reused by an object that is not nested within o ([intro.object]).

to:

> The lifetime of an object o of type T ends when:
> — if T is a non-class type, the object is destroyed, or
> — if T is a class type, the destructor call starts, or
> — the storage which the object occupies is released, or is reused by an object that is not nested within o ([intro.object]).

However, [basic.life]/5 says:

> A program may end the lifetime of any object ... by explicitly calling the destructor for an object of a class type with a non-trivial destructor.

Is this an overlook or this means that trivial destructor calls do not "start" and invoking a trivial destructor won't end the lifetime of an object?


STD-DISCUSSION list run by herb.sutter at gmail.com

Older Archives on Google Groups