c++: fix contracts with NRV
[official-gcc.git] / gcc / testsuite / g++.dg / contracts / contracts-post7.C
blob1c33181b5e60d7adaa6b44294e4458e7c7a122e0
1 // { dg-do run }
2 // { dg-options "-std=c++2a -fcontracts" }
4 #include <experimental/contract>
6 using std::experimental::contract_violation;
7 void handle_contract_violation(const contract_violation &violation)
9   __builtin_exit (0);
12 struct A {
13   int i;
14   A(): i(42) {}
15   A(const A&);
18 A f()
19   [[ post r: r.i == 24 ]]
21   A a;
22   return a;
25 int main()
27   f();
28   return -1;