Debian Codegraph @

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

raw
1 // We were failing to apply post conditions to void functions.
2
3 // { dg-do run }
4 // { dg-options "-std=c++20 -fcontracts -fcontract-continuation-mode=on" }
5 // { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
6
7
8 void foo (const int b)
9 [[ post: b == 9 ]] // contract not checked
10 {}
11
12 int main()
13 {
14 foo(3);
15 }
16
17 // { dg-output "contract violation in function foo at .*.C:9: b == 9.*(\n|\r\n|\r)" }