repo.or.cz
/
netbsd-mini2440.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
No empty .Rs/.Re
[netbsd-mini2440.git]
/
gnu
/
dist
/
gcc4
/
gcc
/
testsuite
/
g++.dg
/
opt
/
nrv9.C
blob
462506867d439fef6a89256d30fc0593e4484b34
1
// PR c++/19317
2
// If we do both NRV and caller-side return slot opt for ga = f()
3
// constructing la sets ga.i to 0 too soon.
4
5
extern "C" void abort();
6
7
struct A
8
{
9
int i;
10
int pad[32]; // force return in memory
11
A(): i(0) {}
12
A(int ia): i(ia) {}
13
};
14
15
A ga(42);
16
17
A f()
18
{
19
A la;
20
if (ga.i != 42)
21
abort();
22
return la;
23
}
24
25
int main()
26
{
27
ga = f ();
28
}