Skip to content

Commit 78621e4

Browse files
committed
[libcxxabi] Reorder base class initializers in libc++abi tests to prevent -Wreorder
Summary: This patch fixes -Wreorder warnings on test classes with virtual bases. Since the compiler is performing the reordering anyway this change *should* have NFC. However the test notes that it is checking that "virtual base classes work properly". Since initialization order is clearly part of correctness I want to confirm that this wasn't an intentional mistake. Reviewers: mclow.lists, howard.hinnant Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21396 llvm-svn: 272821
1 parent 7005a92 commit 78621e4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

libcxxabi/test/catch_class_04.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ struct A
6666
{
6767
static int count;
6868
int id_;
69-
explicit A(int id) : C1(id-1), C2(id-2), B(id+3), id_(id) {count++;}
70-
A(const A& a) : C1(a.id_-1), C2(a.id_-2), B(a.id_+3), id_(a.id_) {count++;}
69+
explicit A(int id) : B(id+3), C1(id-1), C2(id-2), id_(id) {count++;}
70+
A(const A& a) : B(a.id_+3), C1(a.id_-1), C2(a.id_-2), id_(a.id_) {count++;}
7171
~A() {count--;}
7272
};
7373

libcxxabi/test/catch_ptr.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ struct A
6666
{
6767
static int count;
6868
int id_;
69-
explicit A(int id) : C1(id-1), C2(id-2), B(id+3), id_(id) {count++;}
70-
A(const A& a) : C1(a.id_-1), C2(a.id_-2), B(a.id_+3), id_(a.id_) {count++;}
69+
explicit A(int id) : B(id+3), C1(id-1), C2(id-2), id_(id) {count++;}
70+
A(const A& a) : B(a.id_+3), C1(a.id_-1), C2(a.id_-2), id_(a.id_) {count++;}
7171
~A() {count--;}
7272
};
7373

0 commit comments

Comments
 (0)