tigerleapgorge created this revision. Herald added a subscriber: mehdi_amini.
I am continuing to make Lit tests C++11 compatible. This patch contains 2 tests previously in https://reviews.llvm.org/D20710. In both tests, I have made the base class destructors “protected” so they are accessible to derived classes. In C++11, an inaccessible destructor is considered implicitly deleted and this causes the following type of compilation errors. f.h:82:13: error: deleted function '~C3' cannot override a non-deleted function C3: ^ f.h:61:15: note: overridden virtual function is here virtual ~ ^ f.h:83:15: note: destructor of 'C3' is implicitly deleted because base class '(anonymous namespace)::AAA' has an inaccessible destructor AAA { ^ https://reviews.llvm.org/D29972 Files: test/CodeGenCXX/debug-info-use-after-free.cpp test/CodeGenCXX/dynamic-cast-hint.cpp Index: test/CodeGenCXX/dynamic-cast-hint.cpp =================================================================== --- test/CodeGenCXX/dynamic-cast-hint.cpp +++ test/CodeGenCXX/dynamic-cast-hint.cpp @@ -1,7 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++98 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++11 -o - %s | FileCheck %s -class A { virtual ~A() {} }; -class B { virtual ~B() {} }; +class A { protected: virtual ~A() {} }; +class B { protected: virtual ~B() {} }; class C : A { char x; }; class D : public A { short y; }; Index: test/CodeGenCXX/debug-info-use-after-free.cpp =================================================================== --- test/CodeGenCXX/debug-info-use-after-free.cpp +++ test/CodeGenCXX/debug-info-use-after-free.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only -std=c++98 %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only -std=c++11 %s // Check that we don't crash. // PR12305, PR12315 @@ -233,6 +235,7 @@ namespace { class AAA { +protected: virtual ~ AAA () { }};
Index: test/CodeGenCXX/dynamic-cast-hint.cpp =================================================================== --- test/CodeGenCXX/dynamic-cast-hint.cpp +++ test/CodeGenCXX/dynamic-cast-hint.cpp @@ -1,7 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++98 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++11 -o - %s | FileCheck %s -class A { virtual ~A() {} }; -class B { virtual ~B() {} }; +class A { protected: virtual ~A() {} }; +class B { protected: virtual ~B() {} }; class C : A { char x; }; class D : public A { short y; }; Index: test/CodeGenCXX/debug-info-use-after-free.cpp =================================================================== --- test/CodeGenCXX/debug-info-use-after-free.cpp +++ test/CodeGenCXX/debug-info-use-after-free.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only -std=c++98 %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only -std=c++11 %s // Check that we don't crash. // PR12305, PR12315 @@ -233,6 +235,7 @@ namespace { class AAA { +protected: virtual ~ AAA () { }};
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits