1 // RUN: clang-cc  -fsyntax-only -Wreorder -verify %s
2 
3 struct BB {};
4 
5 struct BB1 {};
6 
7 class complex : public BB, BB1 {
8 public:
9   complex() : s2(1),  // expected-warning {{member 's2' will be initialized after}}
10               s1(1) , // expected-note {{field s1}}
11               s3(3),  // expected-warning {{member 's3' will be initialized after}}
12               BB1(),   // expected-note {{base 'struct BB1'}}  \
13                       // expected-warning {{base class 'struct BB1' will be initialized after}}
14               BB() {}  // expected-note {{base 'struct BB'}}
15   int s1;
16   int s2;
17   int s3;
18 };
19 
20 
21 // testing virtual bases.
22 
23 
24 struct V {
25   V();
26 };
27 
28 struct A : public virtual V {
29   A();
30 };
31 
32 struct B : public virtual V {
33   B();
34 };
35 
36 struct Diamond : public A, public B {
37   Diamond() : A(), B() {}
38 };
39 
40 
41 struct C : public A, public B, private virtual V {
42   C() { }
43 };
44 
45 
46 struct D : public A, public B {
47   D()  : A(), V() {   } // expected-warning {{base class 'struct A' will be initialized after}} \
48                         // expected-note {{base 'struct V'}}
49 };
50 
51 
52 struct E : public A, public B, private virtual V {
53   E()  : A(), V() {  } // expected-warning {{base class 'struct A' will be initialized after}} \
54                        // expected-note {{base 'struct V'}}
55 };
56 
57 
58 struct A1  {
59   A1();
60 };
61 
62 struct B1 {
63   B1();
64 };
65 
66 struct F : public A1, public B1, private virtual V {
67   F()  : A1(), V() {  }	// expected-warning {{base class 'struct A1' will be initialized after}} \
68 			// expected-note {{base 'struct V'}}
69 };
70 
71 struct X : public virtual A, virtual V, public virtual B {
72   X(): A(), V(), B() {}	// expected-warning {{base class 'struct A' will be initialized after}} \
73 			// expected-note {{base 'struct V'}}
74 };
75 
76 class Anon {
77   int c; union {int a,b;}; int d;
78   Anon() : c(10), b(1), d(2) {}
79 };
80 class Anon2 {
81   int c; union {int a,b;}; int d;
82   Anon2() : c(2),
83             d(10), // expected-warning {{member 'd' will be initialized after}}
84             b(1) {} // expected-note {{field b}}
85 };
86 class Anon3 {
87   union {int a,b;};
88   Anon3() : b(1) {}
89 };
90