tmp/tmp_sbdfiwt/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Assertion statement <a id="stmt.contract.assert">[[stmt.contract.assert]]</a>
|
| 2 |
+
|
| 3 |
+
``` bnf
|
| 4 |
+
assertion-statement:
|
| 5 |
+
'contract_assert' attribute-specifier-seqₒₚₜ '(' conditional-expression ')' ';'
|
| 6 |
+
```
|
| 7 |
+
|
| 8 |
+
An *assertion-statement* introduces a contract assertion
|
| 9 |
+
[[basic.contract]]. The optional *attribute-specifier-seq* appertains to
|
| 10 |
+
the introduced contract assertion.
|
| 11 |
+
|
| 12 |
+
The predicate [[basic.contract.general]] of an *assertion-statement* is
|
| 13 |
+
its *conditional-expression* contextually converted to `bool`.
|
| 14 |
+
|
| 15 |
+
The evaluation of consecutive *assertion-statement*s is an evaluation in
|
| 16 |
+
sequence [[basic.contract.eval]] of the contract assertions introduced
|
| 17 |
+
by those *assertion-statement*s.
|
| 18 |
+
|
| 19 |
+
[*Note 1*:
|
| 20 |
+
|
| 21 |
+
A sequence of *assertion-statement*s can thus be repeatedly evaluated as
|
| 22 |
+
a group.
|
| 23 |
+
|
| 24 |
+
[*Example 1*:
|
| 25 |
+
|
| 26 |
+
``` cpp
|
| 27 |
+
int f(int i)
|
| 28 |
+
{
|
| 29 |
+
contract_assert(i == 0); // #1
|
| 30 |
+
contract_assert(i >= 0); // #2
|
| 31 |
+
return 0;
|
| 32 |
+
}
|
| 33 |
+
int g = f(0); // can evaluate #1, #2, #1, #2
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
— *end example*]
|
| 37 |
+
|
| 38 |
+
— *end note*]
|
| 39 |
+
|