Debian Codegraph @

gcc/testsuite/g++.dg/contracts/contracts5.C

raw
1 // ensure an audit level assert with a failing predicate generates an error
2 // during runtime when the contract build level is audit
3 // { dg-do run }
4 // { dg-options "-std=c++2a -fcontracts -fcontract-build-level=audit" }
5 // { dg-shouldfail "assert violation" }
6 // { dg-output "contract violation in function main" }
7 // { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
8
9 int main()
10 {
11 int x = 1;
12 [[assert audit: x < 0]];
13 return 0;
14 }