1 // RUN: %clang_cc1 -fsyntax-only -Wreorder -verify %s
7 class complex : public BB
, BB1
{
10 : s2(1), // expected-warning {{initializer order does not match the declaration order}} expected-note {{field 's2' will be initialized after field 's1'}}
12 s3(3), // expected-note {{field 's3' will be initialized after base 'BB1'}}
13 BB1(), // expected-note {{base class 'BB1' will be initialized after base 'BB'}}
21 // testing virtual bases.
28 struct A
: public virtual V
{
32 struct B
: public virtual V
{
36 struct Diamond
: public A
, public B
{
37 Diamond() : A(), B() {}
41 struct C
: public A
, public B
, private virtual V
{
46 struct D
: public A
, public B
{
47 D() : A(), V() { } // expected-warning {{base class 'A' will be initialized after base 'V'}}
51 struct E
: public A
, public B
, private virtual V
{
52 E() : A(), V() { } // expected-warning {{base class 'A' will be initialized after base 'V'}}
64 struct F
: public A1
, public B1
, private virtual V
{
65 F() : A1(), V() { } // expected-warning {{base class 'A1' will be initialized after base 'V'}}
68 struct X
: public virtual A
, virtual V
, public virtual B
{
69 X(): A(), V(), B() {} // expected-warning {{base class 'A' will be initialized after base 'V'}}
73 int c
; union {int a
,b
;}; int d
;
74 Anon() : c(10), b(1), d(2) {}
77 int c
; union {int a
,b
;}; int d
;
79 d(10), // expected-warning {{field 'd' will be initialized after field 'b'}}
90 struct S2
: virtual S1
{ };
93 struct S4
: virtual S3
, S2
{
94 S4() : S2(), // expected-warning {{base class 'S2' will be initialized after base 'S3'}}
100 struct Foo
{ Foo(); };
102 template <class T
> A(T
*t
) :
103 y(), // expected-warning {{field 'y' will be initialized after field 'x'}}
111 // PR6575: this should not crash
114 MyClass() : m_int(0) {}
128 template <class T
> Y(T x
) : X(x
) { }
139 foo() : b(), a() { // expected-warning {{field 'b' will be initialized after field 'a'}}