gcc/testsuite/g++.dg/opt/pr19317-2.C
raw| 1 | // PR c++/19317 |
| 2 | // { dg-options "-O2" } |
| 3 | // { dg-do run } |
| 4 | |
| 5 | extern "C" void abort (void); |
| 6 | |
| 7 | struct A |
| 8 | { |
| 9 | A () { d = e = 0; f = -1; } |
| 10 | A (int x) : d (0), e (0), f (x) { } |
| 11 | A b () const; |
| 12 | int d; |
| 13 | int e; |
| 14 | int f; |
| 15 | }; |
| 16 | |
| 17 | A |
| 18 | A::b () const |
| 19 | { |
| 20 | A t; |
| 21 | t.f = 10 + this->f; |
| 22 | return t; |
| 23 | } |
| 24 | |
| 25 | int |
| 26 | main () |
| 27 | { |
| 28 | A a (100); |
| 29 | a = a.b (); |
| 30 | if (a.f != 110) |
| 31 | abort (); |
| 32 | } |