| 1 |
// ensure a default level assert with a failing predicate does generates an |
| 2 |
// error during runtime but lets the program continue and complete |
| 3 |
// successfully when the contract build level is default but continuation on |
| 4 |
// contract failure is switched on |
| 5 |
// { dg-do run } |
| 6 |
// { dg-options "-std=c++2a -fcontracts -fcontract-continuation-mode=on" } |
| 7 |
// { dg-output "contract violation in function main" } |
| 8 |
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } } |
| 9 |
|
| 10 |
int main() |
| 11 |
{ |
| 12 |
int x = 1; |
| 13 |
[[assert default: x < 0]]; |
| 14 |
return 0; |
| 15 |
} |