repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
c++: fix contracts with NRV
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
contracts
/
contracts-post7.C
blob
1c33181b5e60d7adaa6b44294e4458e7c7a122e0
1
// { dg-do run }
2
// { dg-options "-std=c++2a -fcontracts" }
3
4
#include <experimental/contract>
5
6
using std::experimental::contract_violation;
7
void handle_contract_violation(const contract_violation &violation)
8
{
9
__builtin_exit (0);
10
}
11
12
struct A {
13
int i;
14
A(): i(42) {}
15
A(const A&);
16
};
17
18
A f()
19
[[ post r: r.i == 24 ]]
20
{
21
A a;
22
return a;
23
}
24
25
int main()
26
{
27
f();
28
return -1;
29
}