gcc/testsuite/g++.old-deja/g++.pt/tt2.C
raw| 1 | // { dg-do assemble } |
| 2 | |
| 3 | int f1 () { |
| 4 | struct A { |
| 5 | A() : b (2) { } |
| 6 | int fred () { return b.hi_mom; } |
| 7 | struct B { |
| 8 | int hi_mom; |
| 9 | B (int a) { hi_mom = a; } |
| 10 | }; |
| 11 | B b; |
| 12 | }; |
| 13 | A aa; |
| 14 | return aa.fred(); |
| 15 | } |
| 16 | |
| 17 | int f2 () { |
| 18 | struct A { |
| 19 | ~A() { a = 3; } |
| 20 | int a; |
| 21 | int fred () { return a + 1; } |
| 22 | }; |
| 23 | |
| 24 | A ab; |
| 25 | ab.a = 12; |
| 26 | return ab.fred(); |
| 27 | } |