1 // { dg-do run }
2 // prms-id: 789
3
4 extern "C" int printf (const char *, ...);
5 struct foo
6 {
7 static int count;
printfoo8 virtual void print (int i, int j) { printf ("foo[%d][%d] = %d\n", i, j, x); }
9 int x;
foofoo10 foo () { x = count++; }
11 };
12 int foo::count;
13 struct bar : virtual public foo
14 {
printbar15 virtual void print (int i, int j) { printf ("bar[%d][%d] = %d\n", i, j, x); }
16 };
17
18 // bar array[3][3];
19 foo array[3][3];
20
main()21 int main ()
22 {
23 for (int i = 0; i < 3; i++)
24 for (int j = 0; j < 3; j++) {
25 // printf("&a[%d][%d] = %x\n", i, j, (void *)&array[i][j]);
26 array[i][j].print (i, j);
27 }
28 return 0;
29 }
30