summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/leak1.C
blob: 403a7375513c84d87c9ffe066207d7cc11a89967 (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
28
29
30
31
32
33
34
35
36
37
38
39
// { dg-do run  }
int count = 0;

class T {
  int i;
public:
  T() {
    i = 1;
    ++count;
  }
  T(const T& o) {
    i = o.i;
    ++count;
  }
  T operator +(const T& o) {
    T r;
    r.i = this->i + o.i;
    return r;
  }
  operator int () {
    return i;
  }
  ~T() {
    --count;
  }
} s, b;

void bar() {
  static int j = int(s+b);
  int i = int(s+b);
}

int i = int(s+b);

int main() {
  bar();
  bar();
  return count != 2;
}