brintos

brintos / llvm-project-archived public Read only

0
0
Text · 975 B · f39c8bf Raw
23 lines · cpp
1// Due to the fix having multiple edits we can't use2// '-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-temporary6// RUN: %clang_cc1 %s -Wreorder-ctor -verify -verify-ignore-unexpected=note7 8struct Foo {9  int A, B, C;10 11  Foo() : A(1), B(3), C(2) {}12  Foo(int) : A(1), C(2), B(3) {}      // expected-warning {{field 'C' will be initialized after field 'B'}}13  Foo(unsigned) : C(2), B(3), A(1) {} // expected-warning {{initializer order does not match the declaration order}}14};15 16struct Bar : Foo {17  int D, E, F;18 19  Bar() : Foo(), D(1), E(2), F(3) {}20  Bar(int) : D(1), E(2), F(3), Foo(4) {}      // expected-warning {{field 'F' will be initialized after base 'Foo'}}21  Bar(unsigned) : F(3), E(2), D(1), Foo(4) {} // expected-warning {{initializer order does not match the declaration order}}22};23