2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -Wreorder -verify %s
|
2009-07-10 03:59:47 +08:00
|
|
|
|
2009-07-11 04:13:23 +08:00
|
|
|
struct BB {};
|
2009-07-10 03:59:47 +08:00
|
|
|
|
2009-07-11 04:13:23 +08:00
|
|
|
struct BB1 {};
|
2009-07-10 03:59:47 +08:00
|
|
|
|
2009-07-11 04:13:23 +08:00
|
|
|
class complex : public BB, BB1 {
|
2009-07-10 03:59:47 +08:00
|
|
|
public:
|
|
|
|
complex() : s2(1), // expected-warning {{member 's2' will be initialized after}}
|
|
|
|
s1(1) , // expected-note {{field s1}}
|
|
|
|
s3(3), // expected-warning {{member 's3' will be initialized after}}
|
2009-07-11 04:13:23 +08:00
|
|
|
BB1(), // expected-note {{base 'struct BB1'}} \
|
|
|
|
// expected-warning {{base class 'struct BB1' will be initialized after}}
|
|
|
|
BB() {} // expected-note {{base 'struct BB'}}
|
2009-07-10 03:59:47 +08:00
|
|
|
int s1;
|
|
|
|
int s2;
|
|
|
|
int s3;
|
|
|
|
};
|
2009-07-11 04:13:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
// testing virtual bases.
|
|
|
|
|
|
|
|
|
|
|
|
struct V {
|
|
|
|
V();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct A : public virtual V {
|
|
|
|
A();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B : public virtual V {
|
|
|
|
B();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Diamond : public A, public B {
|
|
|
|
Diamond() : A(), B() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct C : public A, public B, private virtual V {
|
|
|
|
C() { }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct D : public A, public B {
|
|
|
|
D() : A(), V() { } // expected-warning {{base class 'struct A' will be initialized after}} \
|
|
|
|
// expected-note {{base 'struct V'}}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct E : public A, public B, private virtual V {
|
|
|
|
E() : A(), V() { } // expected-warning {{base class 'struct A' will be initialized after}} \
|
|
|
|
// expected-note {{base 'struct V'}}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct A1 {
|
|
|
|
A1();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B1 {
|
|
|
|
B1();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct F : public A1, public B1, private virtual V {
|
2009-09-09 23:08:12 +08:00
|
|
|
F() : A1(), V() { } // expected-warning {{base class 'struct A1' will be initialized after}} \
|
|
|
|
// expected-note {{base 'struct V'}}
|
2009-07-11 04:13:23 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct X : public virtual A, virtual V, public virtual B {
|
2009-09-09 23:08:12 +08:00
|
|
|
X(): A(), V(), B() {} // expected-warning {{base class 'struct A' will be initialized after}} \
|
|
|
|
// expected-note {{base 'struct V'}}
|
2009-07-11 04:13:23 +08:00
|
|
|
};
|
|
|
|
|
2009-07-22 03:28:10 +08:00
|
|
|
class Anon {
|
|
|
|
int c; union {int a,b;}; int d;
|
|
|
|
Anon() : c(10), b(1), d(2) {}
|
|
|
|
};
|
|
|
|
class Anon2 {
|
|
|
|
int c; union {int a,b;}; int d;
|
|
|
|
Anon2() : c(2),
|
|
|
|
d(10), // expected-warning {{member 'd' will be initialized after}}
|
|
|
|
b(1) {} // expected-note {{field b}}
|
|
|
|
};
|
|
|
|
class Anon3 {
|
|
|
|
union {int a,b;};
|
|
|
|
Anon3() : b(1) {}
|
|
|
|
};
|