2.6 KiB
[basic.contract.general]
6 Basics [basic]
6.11 Contract assertions [basic.contract]
6.11.1 General [basic.contract.general]
Contract assertions allow the programmer to specify properties of the state of the program that are expected to hold at certain points during execution.
Contract assertions are introduced byprecondition-specifiers,postcondition-specifiers ([dcl.contract.func]), andassertion-statements ([stmt.contract.assert]).
Each contract assertion has a contract-assertion predicate, which is an expression of type bool.
[Note 1:
The value of the predicate is used to identify program states that are expected.
â end note]
An invocation of the macro va_start ([cstdarg.syn]) shall not be a subexpression of the predicate of a contract assertion, no diagnostic required.
[Note 2:
Within the predicate of a contract assertion,id-expressions referring to variables declared outside the contract assertion are const ([expr.prim.id.unqual]),this is a pointer to const ([expr.prim.this]), and the result object can be named if a result-name-introducer ([dcl.contract.res]) has been specified.
â end note]