From 0aee7324b5220dfa58de5ff70a4a9b14cf23be40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Sun, 12 Sep 2021 23:58:23 +0200 Subject: [PATCH 1/6] =?UTF-8?q?[basic.life]=20Add=20that=20storage=20relea?= =?UTF-8?q?se=20also=20ends=20an=20object=E2=80=99s=20lifetime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/basic.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index 5a8e6296de..c4c01a5ddc 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3350,7 +3350,7 @@ \end{note} \pnum -A program may end the lifetime of any object by reusing the storage +A program may end the lifetime of any object by reusing or releasing the storage which the object occupies or by explicitly calling a destructor or pseudo-destructor\iref{expr.prim.id.dtor} for the object. For an object of a class type, the program is not required to From f4cbf5462dacf003f5e8802f9b3b5103b9af9b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Mon, 27 Sep 2021 09:05:59 +0200 Subject: [PATCH 2/6] Remove incomplete repetition of end-of-lifetime rules --- source/basic.tex | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index c4c01a5ddc..523e6cf59a 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3318,7 +3318,7 @@ and except as described in \ref{allocator.members}. The lifetime of an object \placeholder{o} of type \tcode{T} ends when: \begin{itemize} -\item if \tcode{T} is a non-class type, the object is destroyed, or +\item if \tcode{T} is a non-class type, the object is pseudo-destroyed\iref{expr.prim.id.dtor}, or \item if \tcode{T} is a class type, the destructor call starts, or \item the storage which the object occupies is released, or is reused by an object that is not nested within \placeholder{o}\iref{intro.object}. @@ -3350,9 +3350,7 @@ \end{note} \pnum -A program may end the lifetime of any object by reusing or releasing the storage -which the object occupies or by explicitly calling a destructor -or pseudo-destructor\iref{expr.prim.id.dtor} for the object. +A program may end the lifetime of any object as described above. For an object of a class type, the program is not required to call the destructor explicitly before the storage which the object occupies is reused or released; however, if there is no explicit call to From 9c9bb6d3eea3ac6504a7b7fba50f0781f22233b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Wed, 29 Sep 2021 19:04:07 +0200 Subject: [PATCH 3/6] [basic.life] Remove a repetition of the end-of-lifetime rules --- source/basic.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index 523e6cf59a..7dec27a862 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3318,7 +3318,7 @@ and except as described in \ref{allocator.members}. The lifetime of an object \placeholder{o} of type \tcode{T} ends when: \begin{itemize} -\item if \tcode{T} is a non-class type, the object is pseudo-destroyed\iref{expr.prim.id.dtor}, or +\item if \tcode{T} is a non-class type, the object is destroyed or pseudo-destroyed\iref{expr.prim.id.dtor}, or \item if \tcode{T} is a class type, the destructor call starts, or \item the storage which the object occupies is released, or is reused by an object that is not nested within \placeholder{o}\iref{intro.object}. From ea5e628448960ae5db6025ca4f4e31d0404a33c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Thu, 30 Sep 2021 17:40:40 +0200 Subject: [PATCH 4/6] [basic.life] Remove a partial repetition of the end-of-lifetime rules --- source/basic.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index 7dec27a862..b8d38d1bce 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3318,7 +3318,7 @@ and except as described in \ref{allocator.members}. The lifetime of an object \placeholder{o} of type \tcode{T} ends when: \begin{itemize} -\item if \tcode{T} is a non-class type, the object is destroyed or pseudo-destroyed\iref{expr.prim.id.dtor}, or +\item if \tcode{T} is a non-class type, the object is destroyed, or \item if \tcode{T} is a class type, the destructor call starts, or \item the storage which the object occupies is released, or is reused by an object that is not nested within \placeholder{o}\iref{intro.object}. From 3f7fb25368566fa0acf8d1d32f6e02fbefabf854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Thu, 21 Oct 2021 08:16:51 +0200 Subject: [PATCH 5/6] [basic.life] Remove a partial repetition of the end-of-lifetime rules --- source/basic.tex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index b8d38d1bce..2f92547ef5 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3350,14 +3350,14 @@ \end{note} \pnum -A program may end the lifetime of any object as described above. -For an object of a class type, the program is not required to -call the destructor explicitly before the storage which the object -occupies is reused or released; however, if there is no explicit call to -the destructor or if a \grammarterm{delete-expression}\iref{expr.delete} -is not used to release the storage, the destructor is not -implicitly called and any program that depends on the side effects -produced by the destructor has undefined behavior. +A program may end the lifetime of an object of class type without invoking the +destructor, by reusing or releasing the storage as described above. +\begin{note} +A \grammarterm{delete-expression}\iref{expr.delete} invokes the destructor +prior to releasing the storage. +\end{note} +In this case, the destructor is not implicitly invoked and any program that +depends on the side effects produced by the destructor has undefined behavior. \pnum Before the lifetime of an object has started but after the storage which From 8d2ae2013642231f94e0c56aaa9ae9e67a03b3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Thu, 21 Oct 2021 08:20:43 +0200 Subject: [PATCH 6/6] [basic.life] Remove a partial repetition of the end-of-lifetime rules --- source/basic.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index 2f92547ef5..7b3c364e30 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3350,13 +3350,13 @@ \end{note} \pnum -A program may end the lifetime of an object of class type without invoking the +A program may end the lifetime of an object of class type without invoking the destructor, by reusing or releasing the storage as described above. \begin{note} -A \grammarterm{delete-expression}\iref{expr.delete} invokes the destructor +A \grammarterm{delete-expression}\iref{expr.delete} invokes the destructor prior to releasing the storage. \end{note} -In this case, the destructor is not implicitly invoked and any program that +In this case, the destructor is not implicitly invoked and any program that depends on the side effects produced by the destructor has undefined behavior. \pnum