Skip to content

Commit fa926f8

Browse files
jensmaurerzygoloid
authored andcommitted
P0542R5 Support for contract based programming in C++
1 parent f39c107 commit fa926f8

File tree

10 files changed

+615
-16
lines changed

10 files changed

+615
-16
lines changed

source/basic.tex

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,15 @@
553553
requirement applies recursively)\footnote{\ref{dcl.fct.default}
554554
describes how default argument names are looked up.}; and
555555

556+
\item it is
557+
\impldef{consistency of build level and violation continuation mode}
558+
the conditions under which ---
559+
if \tcode{D} contains an assertion, has a postcondition,
560+
or invokes a function with a precondition ---
561+
each definition of \tcode{D} shall be translated
562+
using the same build level
563+
and violation continuation mode\iref{dcl.attr.contract}; and
564+
556565
\item if \tcode{D} is a class with an implicitly-declared
557566
constructor\iref{class.ctor}, it is as if the constructor was
558567
implicitly defined in every translation unit where it is odr-used, and the
@@ -984,8 +993,9 @@
984993
The potential scope of a name declared in a class consists not
985994
only of the declarative region following the name's point of
986995
declaration, but also of all function bodies, default arguments,
987-
\grammarterm{noexcept-specifier}{s}, and
988-
default member initializers\iref{class.mem}
996+
\grammarterm{noexcept-specifier}{s},
997+
default member initializers\iref{class.mem},
998+
and contract conditions\iref{dcl.attr.contract}
989999
in that class (including such
9901000
things in nested classes).
9911001

@@ -1330,6 +1340,7 @@
13301340
A name used in the definition of a class \tcode{X} outside of a member
13311341
function body, default argument, \grammarterm{noexcept-specifier},
13321342
default member initializer\iref{class.mem},
1343+
contract condition\iref{dcl.attr.contract},
13331344
or nested class definition\footnote{This refers to unqualified names
13341345
following the class name; such a name may be used in the
13351346
\grammarterm{base-clause} or may be used in the class definition.}
@@ -1393,11 +1404,14 @@
13931404
\end{note}
13941405

13951406
\pnum
1396-
For the members of a class \tcode{X}, a name used in a member function
1397-
body, in a default argument, in a \grammarterm{noexcept-specifier}, in a
1398-
default member initializer\iref{class.mem}, or in the definition of a class member
1399-
outside of the definition of \tcode{X}, following the
1400-
member's
1407+
For the members of a class \tcode{X}, a name used
1408+
in a member function body,
1409+
in a default argument,
1410+
in a \grammarterm{noexcept-specifier},
1411+
in a default member initializer\iref{class.mem},
1412+
in a contract condition\iref{dcl.attr.contract}, or
1413+
in the definition of a class member outside of the definition of \tcode{X},
1414+
following the member's
14011415
\grammarterm{declarator-id}\footnote{That is, an unqualified name that occurs,
14021416
for instance, in a
14031417
type in the

source/classes.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,9 @@
563563
Within the class
564564
\grammarterm{member-specification}, the class is regarded as complete
565565
within function bodies, default arguments,
566-
\grammarterm{noexcept-specifier}{s}, and
567-
default member initializers
566+
\grammarterm{noexcept-specifier}{s},
567+
default member initializers, and
568+
contract conditions\iref{dcl.attr.contract}
568569
(including such things in nested classes).
569570
Otherwise it is regarded as incomplete within its own class
570571
\grammarterm{member-specification}.

0 commit comments

Comments
 (0)