1 // RUN: clang-reorder-fields -record-name bar::Foo -fields-order y,z,c,x %s -- 2>&1 | FileCheck --check-prefix=CHECK-MESSAGES %s
2 // FIXME: clang-reorder-fields should provide -verify mode to make writing these checks
3 // easier and more accurate, for now we follow clang-tidy's approach.
8 Dummy(int x
, char c
) : x(x
), c(c
) {}
15 Foo(int x
, double y
, char cin
);
24 static char bar(char c
) {
28 Foo::Foo() : x(), y(), c(), z(0, 'a') {}
30 Foo::Foo(int x
, double y
, char cin
) :
35 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: reordering field x after z makes x uninitialized when used in init expression
36 // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: reordering field c after z makes c uninitialized when used in init expression
44 // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: reordering field x after y makes x uninitialized when used in init expression
45 // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: reordering field x after z makes x uninitialized when used in init expression
46 // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: reordering field c after z makes c uninitialized when used in init expression
52 bar::Foo
F(5, 12.8, 'c');