Skip to content

Commit c458614

Browse files
authored
Merge 2019-07 CWG Motion 16
P1823R0 Remove contracts from C++20 Fixes #2996.
2 parents 216c993 + cd726ee commit c458614

File tree

11 files changed

+9
-585
lines changed

11 files changed

+9
-585
lines changed

source/basic.tex

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,6 @@
618618
that is, the default argument or default template argument
619619
is subject to the requirements described in this paragraph (recursively); and
620620

621-
\item if \tcode{D} invokes a function with a precondition,
622-
or is a function
623-
that contains an assertion or has a contract condition\iref{dcl.attr.contract},
624-
it is \impldef{consistency of build level and violation continuation mode}
625-
under which conditions all definitions of \tcode{D}
626-
shall be translated using the same build level
627-
and violation continuation mode; and
628-
629621
\item if \tcode{D} is a class with an implicitly-declared
630622
constructor (\ref{class.default.ctor}, \ref{class.copy.ctor}),
631623
it is as if the constructor was

source/classes.tex

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,7 @@
562562
\begin{itemize}
563563
\item function body\iref{dcl.fct.def.general},
564564
\item default argument\iref{dcl.fct.default},
565-
\item \grammarterm{noexcept-specifier}\iref{except.spec},
566-
\item contract condition\iref{dcl.attr.contract}, or
565+
\item \grammarterm{noexcept-specifier}\iref{except.spec}, or
567566
\item default member initializer
568567
\end{itemize}
569568
within the \grammarterm{member-specification} of the class.
@@ -4105,45 +4104,6 @@
41054104
A \tcode{consteval} virtual function shall not be overridden by
41064105
a virtual function that is not \tcode{consteval}.
41074106

4108-
\pnum
4109-
If an overriding function specifies contract conditions\iref{dcl.attr.contract},
4110-
it shall specify the same list of contract conditions as
4111-
its overridden functions;
4112-
no diagnostic is required
4113-
if corresponding conditions will always evaluate to the same value.
4114-
Otherwise, it is considered to have
4115-
the list of contract conditions from one of its overridden functions;
4116-
the names in the contract conditions are bound,
4117-
and the semantic constraints are checked,
4118-
at the point where the contract conditions appear.
4119-
Given a virtual function \tcode{f}
4120-
with a contract condition that odr-uses \tcode{*this}\iref{basic.def.odr},
4121-
the class of which \tcode{f} is a direct member
4122-
shall be be an unambiguous and accessible base class of any class
4123-
in which \tcode{f} is overridden.
4124-
If a function overrides more than one function,
4125-
all of the overridden functions shall have
4126-
the same list of contract conditions\iref{dcl.attr.contract};
4127-
no diagnostic is required
4128-
if corresponding conditions will always evaluate to the same value.
4129-
\begin{example}
4130-
\begin{codeblock}
4131-
struct A {
4132-
virtual void g() [[expects: x == 0]];
4133-
int x = 42;
4134-
};
4135-
4136-
int x = 42;
4137-
struct B {
4138-
virtual void g() [[expects: x == 0]];
4139-
}
4140-
4141-
struct C : A, B {
4142-
virtual void g(); // error: preconditions of overridden functions are not the same
4143-
};
4144-
\end{codeblock}
4145-
\end{example}
4146-
41474107
\rSec2[class.abstract]{Abstract classes}%
41484108

41494109
\pnum

source/compatibility.tex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,6 @@
21242124
\tcode{<bit>},
21252125
\tcode{<compare>},
21262126
\tcode{<concepts>},
2127-
\tcode{<contract>},
21282127
\tcode{<coroutine>},
21292128
\tcode{<ranges>},
21302129
\tcode{<span>},

0 commit comments

Comments
 (0)