Debian Codegraph @

gcc/testsuite/g++.dg/contracts/contracts18.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-role=custom:never,ignore,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 %custom: x > 0]];
13 [[assert audit %custom: x < 0]];
14 return 0;
15 }
16