summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/delete.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-07-13 00:54:47 +0000
committerDouglas Gregor <dgregor@apple.com>2011-07-13 00:54:47 +0000
commit1c2e20d73d39b6b3087e33fb8c7aa58b463017b9 (patch)
treec8953e89042c541f9f432a1dae41d0f5b7c5eb23 /clang/test/CodeGenCXX/delete.cpp
parentee6e776be2e4f68606378906e8079a9dfda5a47b (diff)
downloadbcm5719-llvm-1c2e20d73d39b6b3087e33fb8c7aa58b463017b9.tar.gz
bcm5719-llvm-1c2e20d73d39b6b3087e33fb8c7aa58b463017b9.zip
When compiling ::delete for a class with a virtual destructor, call
the complete destructor and then invoke the global delete operator. Previously, we would invoke the deleting destructor, which calls the wrong delete operator. Fixes PR10341. llvm-svn: 135021
Diffstat (limited to 'clang/test/CodeGenCXX/delete.cpp')
-rw-r--r--clang/test/CodeGenCXX/delete.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/delete.cpp b/clang/test/CodeGenCXX/delete.cpp
index 51c860e9097..f3586d46740 100644
--- a/clang/test/CodeGenCXX/delete.cpp
+++ b/clang/test/CodeGenCXX/delete.cpp
@@ -112,3 +112,22 @@ namespace test3 {
delete a;
}
}
+
+namespace test4 {
+ // PR10341: ::delete with a virtual destructor
+ struct X {
+ virtual ~X();
+ void operator delete (void *);
+ };
+
+ // CHECK: define void @_ZN5test421global_delete_virtualEPNS_1XE
+ void global_delete_virtual(X *xp) {
+ // CHECK: [[VTABLE:%.*]] = load void ([[X:%.*]])***
+ // CHECK-NEXT: [[VFN:%.*]] = getelementptr inbounds void ([[X]])** [[VTABLE]], i64 0
+ // CHECK-NEXT: [[VFNPTR:%.*]] = load void ([[X]])** [[VFN]]
+ // CHECK-NEXT: call void [[VFNPTR]]([[X]] [[OBJ:%.*]])
+ // CHECK-NEXT: [[OBJVOID:%.*]] = bitcast [[X]] [[OBJ]] to i8*
+ // CHECK-NEXT: call void @_ZdlPv(i8* [[OBJVOID]]) nounwind
+ ::delete xp;
+ }
+}
OpenPOWER on IntegriCloud