1 // Due to the fix having multiple edits we can't use 2 // '-fdiagnostics-parseable-fixits' to determine if fixes are correct. However, 3 // running fixit recompile with 'Werror' should fail if the fixes are invalid. 4 5 // RUN: %clang_cc1 %s -Werror=reorder-ctor -fixit-recompile -fixit-to-temporary 6 // RUN: %clang_cc1 %s -Wreorder-ctor -verify -verify-ignore-unexpected=note 7 8 struct Foo { 9 int A, B, C; 10 FooFoo11 Foo() : A(1), B(3), C(2) {} FooFoo12 Foo(int) : A(1), C(2), B(3) {} // expected-warning {{field 'C' will be initialized after field 'B'}} FooFoo13 Foo(unsigned) : C(2), B(3), A(1) {} // expected-warning {{initializer order does not match the declaration order}} 14 }; 15 16 struct Bar : Foo { 17 int D, E, F; 18 BarBar19 Bar() : Foo(), D(1), E(2), F(3) {} BarBar20 Bar(int) : D(1), E(2), F(3), Foo(4) {} // expected-warning {{field 'F' will be initialized after base 'Foo'}} BarBar21 Bar(unsigned) : F(3), E(2), D(1), Foo(4) {} // expected-warning {{initializer order does not match the declaration order}} 22 }; 23