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++.brendan/] [init3.C] - Blame information for rev 305

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// GROUPS passed initialization
3
// p2766: Make sure that members are initialized in order of declaration
4
// in the class, not in order of specification in the mem-initializer list.
5
 
6
extern "C" int printf (const char *, ...);
7
extern "C" void exit (int);
8
 
9
int count = 0;
10
 
11
void die () { printf ("FAIL\n"); exit (1); }
12
 
13
class bar1 {
14
public:
15
  bar1 (int) { if (count != 0) die (); count = 1; }
16
};
17
 
18
class bar2
19
{
20
public:
21
  bar2 (int) { if (count != 1) die (); count = 2; }
22
};
23
 
24
class foo
25
{
26
public:
27
  bar1 a;
28
  bar2 b;
29
  foo (int, int);
30
};
31
 
32
// bar1 should get built before bar2
33
foo::foo (int x, int y) : b(x), a(y) {}
34
 
35
int main()
36
{
37
  foo f (1, 2);
38
  printf ("PASS\n");
39
}

powered by: WebSVN 2.1.0

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