summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/tt2.C
blob: 694007beb845523fff45d4259dae084a5bfb9414 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// { dg-do assemble  }

int f1 () {
  struct A {
    A() : b (2) { }
    int fred () { return b.hi_mom; }
    struct B {
      int hi_mom;
      B (int a) { hi_mom = a; }
    };
    B b;
  };
  A aa;
  return aa.fred();
}

int f2 () {
  struct A {
    ~A() { a = 3; }
    int a;
    int fred () { return a + 1; }
  };

  A ab;
  ab.a = 12;
  return ab.fred();
}