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
Merge -r 127928:132243 from trunk
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
opt
/
nrv8.C
blob
19999a18824d309cd27cc31437b91e8e8e949a59
1
// PR optimization/19531
2
// forbids NRV on volatile return value.
3
// { dg-options -O2 }
4
// { dg-do run }
5
6
extern "C" { void abort(); }
7
8
struct A
9
{
10
int d;
11
12
A () { d = 123; }
13
A (const A & o) { d = o.d; }
14
A (volatile const A & o) { d = o.d + 2; }
15
};
16
17
A bar()
18
{
19
volatile A l;
20
return l;
21
}
22
23
main()
24
{
25
A a = bar ();
26
27
if (a.d != 125)
28
abort();
29
30
return 0;
31
}