OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.mike/] [misc1.C] - Blame information for rev 384

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// GROUPS passed construct-destruct
3
/* g++ constructs j 13 times, and destructs it once. */
4
 
5
extern "C" {
6
  int printf (const char *, ...);
7
  void exit(int);
8
}
9
 
10
void foo() {
11
}
12
 
13
class C {
14
  int val;
15
 public:
16
  static int count;
17
  C(int ii) {
18
    val = ii;
19
    ++count;
20
    printf("up\n");
21
  }
22
  ~C() {
23
    --count;
24
    printf("down\n");
25
  }
26
  int operator ++() {
27
    return ++val;
28
  }
29
  operator int() {
30
    return val;
31
  }
32
};
33
 
34
int C::count = 0;
35
 
36
void bar() {
37
  for (int ii=0; ii<13; ++ii)
38
    for (C j=1; j<9; ++j)
39
      foo();
40
}
41
 
42
int main() {
43
  bar();
44
  if (C::count)
45
    {
46
      printf("FAIL\n");
47
      exit(1);
48
    }
49
  else
50
    {
51
      printf("PASS\n");
52
    }
53
  return 0;
54
}

powered by: WebSVN 2.1.0

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