Skip to content

Commit fc3df3f

Browse files
committed
CWG2490 Restrictions on destruction in constant expressions
1 parent 1e6a986 commit fc3df3f

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

source/expressions.tex

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7216,6 +7216,11 @@
72167216
that refers to a non-volatile object
72177217
whose lifetime began within the evaluation of $E$;
72187218

7219+
\item
7220+
an invocation of a destructor\iref{class.dtor} or a function call
7221+
whose \grammarterm{postfix-expression} names a pseudo-destructor\iref{expr.call},
7222+
in either case for an object whose lifetime did not begin within the evaluation of $E$;
7223+
72197224
\item
72207225
a \grammarterm{new-expression}\iref{expr.new},
72217226
unless the selected allocation function is
@@ -7319,30 +7324,14 @@
73197324
even if the actual evaluation of such a call
73207325
would otherwise fail the requirements for a core constant expression.
73217326
Similarly, the evaluation of a call to
7322-
\tcode{std::destroy_at},
7323-
\tcode{std::ranges::destroy_at},
7324-
\tcode{std::construct_at}, or
7325-
\tcode{std::ranges::construct_at}
7327+
\tcode{std::construct_at} or \tcode{std::ranges::construct_at}
73267328
does not disqualify $E$
7327-
from being a core constant expression unless:
7328-
\begin{itemize}
7329-
\item
7330-
for a call to \tcode{std::construct_at} or \tcode{std::ranges::construct_at},
7331-
the first argument, of type \tcode{T*},
7332-
does not point
7333-
to storage allocated with \tcode{std::allocator<T>} or
7334-
to an object whose lifetime began within the evaluation of $E$, or
7335-
the evaluation of the underlying constructor call
7336-
disqualifies $E$ from being a core constant expression, or
7337-
\item
7338-
for a call to \tcode{std::destroy_at} or \tcode{std::ranges::destroy_at},
7339-
the first argument, of type \tcode{T*},
7340-
does not point
7341-
to storage allocated with \tcode{std::allocator<T>} or
7342-
to an object whose lifetime began within the evaluation of $E$, or
7343-
the evaluation of the underlying destructor call
7344-
disqualifies $E$ from being a core constant expression.
7345-
\end{itemize}
7329+
from being a core constant expression unless
7330+
the first argument, of type \tcode{T*}, does not point
7331+
to storage allocated with \tcode{std::allocator<T>} or
7332+
to an object whose lifetime began within the evaluation of $E$, or
7333+
the evaluation of the underlying constructor call
7334+
disqualifies $E$ from being a core constant expression.
73467335

73477336
\pnum
73487337
An object \tcode{a} is said to have \defnadj{constant}{destruction} if:

0 commit comments

Comments
 (0)