Debian Codegraph @

gcc/testsuite/g++.dg/contracts/contracts24.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 -fcontract-semantic=default:never -fcontract-semantic=audit:ignore -fcontract-semantic=axiom:ignore" }
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: x > 0]];
13 [[assert audit: x < 0]];
14 return 0;
15 }
16