Skip to content

Commit ce7d8b0

Browse files
burblebeetkoeppe
authored andcommitted
CWG2602 consteval defaulted functions
1 parent 34ac2f4 commit ce7d8b0

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

source/classes.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@
20952095

20962096
\pnum
20972097
A defaulted destructor is a constexpr destructor
2098-
if it satisfies the requirements for a constexpr function\iref{dcl.constexpr}.
2098+
if it is constexpr-suitable\iref{dcl.constexpr}.
20992099

21002100
\pnum
21012101
Before a

source/declarations.tex

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -796,16 +796,17 @@
796796
\pnum
797797
\indextext{specifier!\idxcode{constexpr}!function}%
798798
\indextext{constexpr function}%
799-
The definition of a constexpr function shall satisfy the following
800-
requirements:
799+
A function is \defn{constexpr-suitable} if:
801800
\begin{itemize}
802801
\item
803-
it shall not be a coroutine\iref{dcl.fct.def.coroutine};
802+
it is not a coroutine\iref{dcl.fct.def.coroutine}, and
804803

805804
\item
806805
if the function is a constructor or destructor,
807-
its class shall not have any virtual base classes.
806+
its class does not have any virtual base classes.
808807
\end{itemize}
808+
Except for instantiated constexpr functions,
809+
non-templated constexpr functions shall be constexpr-suitable.
809810

810811
\begin{example}
811812
\begin{codeblock}
@@ -839,16 +840,6 @@
839840
\end{codeblock}
840841
\end{example}
841842

842-
\pnum
843-
If the instantiated template specialization of a constexpr function
844-
template
845-
or member function of a class template
846-
would fail to satisfy the requirements for a constexpr
847-
function,
848-
that specialization is still a constexpr function,
849-
even though a call to such a function cannot appear in a constant
850-
expression.
851-
852843
\pnum
853844
An invocation of a constexpr function in a given context
854845
produces the same result as
@@ -6265,7 +6256,7 @@
62656256
A function explicitly defaulted on its first declaration
62666257
is implicitly inline\iref{dcl.inline},
62676258
and is implicitly constexpr\iref{dcl.constexpr}
6268-
if it satisfies the requirements for a constexpr function.
6259+
if it is constexpr-suitable.
62696260

62706261
\pnum
62716262
\begin{example}

source/expressions.tex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@
19611961
the corresponding \grammarterm{lambda-expression}{'s}
19621962
\grammarterm{parameter-declaration-clause}
19631963
is followed by \keyword{constexpr} or \keyword{consteval}, or
1964-
it satisfies the requirements for a constexpr function\iref{dcl.constexpr}.
1964+
it is constexpr-suitable\iref{dcl.constexpr}.
19651965
It is an immediate function\iref{dcl.constexpr}
19661966
if the corresponding \grammarterm{lambda-expression}{'s}
19671967
\grammarterm{parameter-declaration-clause} is followed by \keyword{consteval}.
@@ -7379,8 +7379,7 @@
73797379

73807380
\item
73817381
an invocation of an instantiated constexpr function
7382-
that fails to satisfy the requirements
7383-
for a constexpr function;
7382+
that is not constexpr-suitable;
73847383

73857384
\item
73867385
an invocation of a virtual function\iref{class.virtual}

0 commit comments

Comments
 (0)