gcc/testsuite/g++.dg/contracts/contracts-post3.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-options "-std=c++2a -fcontracts" } |
| 3 | // { dg-shouldfail "assert violation" } |
| 4 | // { dg-output "contract violation in function f1" } |
| 5 | // { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } } |
| 6 | |
| 7 | int f1(int n) |
| 8 | [[post r: r > n]] |
| 9 | { |
| 10 | return n; |
| 11 | } |
| 12 | |
| 13 | int main() |
| 14 | { |
| 15 | f1(0); |
| 16 | } |