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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// global and local multidimensional array objects are not getting
3
// constructors called on any dimension, other than the first.  Also,
4
// the destructors are not being called.  Seems odd, they probably
5
// used to work. :-(
6
// prms-id: 789
7
 
8
extern "C" int printf (const char *, ...);
9
struct foo
10
{
11
  static int count;
12
  void print (int i, int j) { printf ("foo[%d][%d] = %d\n", i, j, x); }
13
  int x;
14
  foo () {
15
    x = count++;
16
    printf("this %d = %x\n", x, (void *)this);
17
  }
18
  virtual ~foo () {
19
    printf("this %d = %x\n", x, (void *)this);
20
    --count;
21
  }
22
};
23
int foo::count;
24
 
25
 
26
int main ()
27
{
28
  {
29
    foo array[3][3];
30
    for (int i = 0; i < 3; i++)
31
      {
32
        for (int j = 0; j < 3; j++)
33
          {
34
            printf("&a[%d][%d] = %x\n", i, j, (void *)&array[i][j]);
35
          }
36
      }
37
      // The count should be nine, if not, fail the test.
38
      if (foo::count != 9)
39
        return 1;
40
  }
41
  if (foo::count != 0)
42
    return 1;
43
  return 0;
44
}

powered by: WebSVN 2.1.0

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