gcc/testsuite/g++.dg/contracts/contracts2.C
raw| 1 | // check that a valid program using assertions compiles and runs |
| 2 | // ensure an axiom with a failing predicate doesn't prevent a successful run |
| 3 | // (axiom level contracts are never checked at runtime) |
| 4 | // { dg-do run } |
| 5 | // { dg-options "-std=c++2a -fcontracts" } |
| 6 | // { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } } |
| 7 | |
| 8 | int main() |
| 9 | { |
| 10 | int x = 1; |
| 11 | [[assert axiom: x < 0]]; |
| 12 | [[assert default: x > 0]]; |
| 13 | return 0; |
| 14 | } |