ipa-cp: Perform operations in the appropriate types (PR 118097)
[gcc.git] / gcc / testsuite / g++.dg / contracts / contracts-pre2a2.C
blob461fb6fff9325cde217a5b49991e73232c24cfdb
1 // basic test to ensure contracts work pre-c++2a
2 // { dg-do run { target c++11 } }
3 // { dg-additional-options "-fcontracts -fcontract-continuation-mode=on" }
5 int f(int n)
6   [[ pre: n > 0 ]]
7   [[ post r: r < 0 ]]
9   [[ assert: n > 0 ]];
10   return -n;
13 int main()
15   f(-5);
16   return 0;
19 // { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
20 // { dg-output "contract violation in function f at .*\\.C:6: .*(\n|\r\n|\r)" }
21 // { dg-output "contract violation in function f at .*\\.C:9: .*(\n|\r\n|\r)" }
22 // { dg-output "contract violation in function f at .*\\.C:7: .*(\n|\r\n|\r)" }