34 lines · cpp
1// RUN: clang-reorder-fields -record-name bar::Derived -fields-order z,y %s -- | FileCheck %s2 3namespace bar {4class Base {5public:6 Base(int nx, int np) : x(nx), p(np) {}7 int x;8 int p;9};10 11 12class Derived : public Base {13public:14 Derived(long ny);15 Derived(char nz);16private:17 long y;18 char z;19};20 21Derived::Derived(long ny) : 22 Base(ny, 0),23 y(ny), // CHECK: {{^ z\(static_cast<char>\(ny\)\),}}24 z(static_cast<char>(ny)) // CHECK-NEXT: {{^ y\(ny\)}}25{}26 27Derived::Derived(char nz) : 28 Base(1, 2),29 y(nz), // CHECK: {{^ z\(x\),}}30 z(x) // CHECK-NEXT: {{^ y\(nz\)}}31{}32 33} // namespace bar34