Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7822,6 +7822,28 @@
if a \grammarterm{result-name-introducer}\iref{dcl.contract.res} has been specified.
\end{note}

\rSec2[basic.contract.control]{Control}

\indextext{contract assertion!control}%

\begin{bnf}
\nontermdef{assertion-control-specifier}\br
\terminal{<} id-expression \terminal{>}
\end{bnf}

\pnum
The optional \grammarterm{assertion-control-specifier} of a
\grammarterm{precondition-specifier}, \grammarterm{postcondition-specifier},
or \grammarterm{assertion-statement} indicates that the
introduced contract assertion is a \defnadj{terminating}{contract assertion}.

\pnum
The \grammarterm{id-expression}
shall not be
type-dependent or value-dependent and
shall denote
\tcode{std::con\-tracts::con\-trols::enforced}\iref{contracts.syn}.

\rSec2[basic.contract.eval]{Evaluation}

\pnum
Expand All @@ -7841,7 +7863,11 @@
It is
\impldef{evaluation semantic used for the evaluation of a contract assertion}
which evaluation semantic is used
for any given evaluation of a contract assertion.
for any given evaluation of a contract assertion;
the evaluation semantic
used for the evaluation
of a terminating contract assertion
is a terminating semantic.
\begin{note}
The range and flexibility of available choices of
evaluation semantics depends on the implementation
Expand All @@ -7850,12 +7876,19 @@
for different evaluations of the same contract assertion,
including evaluations during constant evaluation.
\end{note}
\begin{note}
The notional evaluation of a contract assertion
to determine if a variable is constant-initializable
is always performed with the ignore evaluation semantic\iref{expr.const.init}.
\end{note}

\pnum
\recommended
An implementation should provide
the option to translate a program
such that all evaluations of contract assertions use the ignore semantic
such that all evaluations of contract assertions
that are not terminating contract assertions
use the ignore semantic
as well as
the option to translate a program
such that all evaluations of contract assertions use the enforce semantic.
Expand Down
9 changes: 7 additions & 2 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4675,12 +4675,13 @@

\begin{bnf}
\nontermdef{precondition-specifier}\br
\keyword{pre} \opt{attribute-specifier-seq} \terminal{(} conditional-expression \terminal{)}
\keyword{pre} \opt{assertion-control-specifier} \opt{attribute-specifier-seq} \terminal{(} conditional-expression \terminal{)}
\end{bnf}

\begin{bnf}
\nontermdef{postcondition-specifier}\br
\keyword{post} \opt{attribute-specifier-seq} \terminal{(} \opt{result-name-introducer} conditional-expression \terminal{)}
\keyword{post} \opt{assertion-control-specifier} \opt{attribute-specifier-seq} \br
\bnfindent \terminal{(} \opt{result-name-introducer} conditional-expression \terminal{)}
\end{bnf}

\pnum
Expand Down Expand Up @@ -4761,6 +4762,10 @@
if
\begin{itemize}
\item
both $C_1$ and $C_2$
have \grammarterm{assertion-control-specifier}s
or neither does,
\item
their predicates $P_1$ and $P_2$ would
satisfy the one-definition rule\iref{basic.def.odr}
if placed in function definitions on
Expand Down
2 changes: 1 addition & 1 deletion source/preprocessor.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2421,7 +2421,7 @@
\defnxname{cpp_constexpr_in_decltype} & \tcode{201711L} \\ \rowsep
\defnxname{cpp_constexpr_virtual_inheritance} & \tcode{202506L} \\ \rowsep
\defnxname{cpp_constinit} & \tcode{201907L} \\ \rowsep
\defnxname{cpp_contracts} & \tcode{202606L} \\ \rowsep
\defnxname{cpp_contracts} & \tcode{202612L} \\ \rowsep
\defnxname{cpp_decltype} & \tcode{200707L} \\ \rowsep
\defnxname{cpp_decltype_auto} & \tcode{201304L} \\ \rowsep
\defnxname{cpp_deduction_guides} & \tcode{202207L} \\ \rowsep
Expand Down
2 changes: 1 addition & 1 deletion source/statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@

\begin{bnf}
\nontermdef{assertion-statement}\br
\terminal{contract_assert} \opt{attribute-specifier-seq} \terminal{(} conditional-expression \terminal{)} \terminal{;}
\terminal{contract_assert} \opt{assertion-control-specifier} \opt{attribute-specifier-seq} \terminal{(} conditional-expression \terminal{)} \terminal{;}
\end{bnf}

\pnum
Expand Down
11 changes: 8 additions & 3 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@
#define @\defnlibxname{cpp_lib_containers_ranges}@ 202202L
// also in \libheader{vector}, \libheader{list}, \libheader{forward_list}, \libheader{map}, \libheader{set}, \libheader{unordered_map}, \libheader{unordered_set},
// \libheader{deque}, \libheader{queue}, \libheader{stack}, \libheader{string}
#define @\defnlibxname{cpp_lib_contracts}@ 202502L // freestanding, also in \libheader{contracts}
#define @\defnlibxname{cpp_lib_contracts}@ 202611L // freestanding, also in \libheader{contracts}
#define @\defnlibxname{cpp_lib_copyable_function}@ 202306L // also in \libheader{functional}
#define @\defnlibxname{cpp_lib_coroutine}@ 201902L // freestanding, also in \libheader{coroutine}
#define @\defnlibxname{cpp_lib_counting_scope}@ 202506L // also in \libheader{execution}
Expand Down Expand Up @@ -4289,8 +4289,9 @@
\rSec2[contracts.syn]{Header \tcode{<contracts>} synopsis}

\pnum
The header \libheader{contracts} defines types
for reporting information about contract violations\iref{basic.contract.eval}.
The header \libheader{contracts} provides facilities
for reporting information about contract violations\iref{basic.contract.eval}
and controlling the behavior of contract assertions\iref{basic.contract.control}.

\indexheader{contracts}
\indexlibraryglobal{contract_violation}%
Expand Down Expand Up @@ -4333,6 +4334,10 @@
};

void invoke_default_contract_violation_handler(const contract_violation&);

namespace controls {
inline constexpr @\unspec@ enforced = @\unspec@;
}
}
\end{codeblock}

Expand Down
Loading