OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.mike/] [leak1.C] - Rev 12

Compare with Previous | Blame | View Log

// { 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;
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.