summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/destructors.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-03-03 03:40:11 +0000
committerJohn McCall <rjmccall@apple.com>2010-03-03 03:40:11 +0000
commit1950a11939b31892a97ca93811eb75fdc3835cc5 (patch)
tree3b3ac7c03623fec5ae812edee773c7c6bb431984 /clang/test/CodeGenCXX/destructors.cpp
parent4eab008b5a300411ba33363d3a5ba68fad0d0712 (diff)
downloadbcm5719-llvm-1950a11939b31892a97ca93811eb75fdc3835cc5.tar.gz
bcm5719-llvm-1950a11939b31892a97ca93811eb75fdc3835cc5.zip
Don't emit derived-to-base destructor aliases if we don't have a definition
for the base destructor, because aliases to declarations aren't legal. Fixes PR 6471. llvm-svn: 97637
Diffstat (limited to 'clang/test/CodeGenCXX/destructors.cpp')
-rw-r--r--clang/test/CodeGenCXX/destructors.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/destructors.cpp b/clang/test/CodeGenCXX/destructors.cpp
index accd1b34986..d40b174012f 100644
--- a/clang/test/CodeGenCXX/destructors.cpp
+++ b/clang/test/CodeGenCXX/destructors.cpp
@@ -104,6 +104,10 @@ namespace test1 {
struct Empty { }; // trivial destructor, empty
struct NonEmpty { int x; }; // trivial destructor, non-empty
+ // There must be a definition in this translation unit for the alias
+ // optimization to apply.
+ A::~A() { delete m; }
+
struct M : A { ~M(); };
M::~M() {} // alias tested above
@@ -133,3 +137,13 @@ namespace test1 {
struct U : A, virtual B { ~U(); };
U::~U() {} // CHECK: define void @_ZN5test11UD2Ev
}
+
+// PR6471
+namespace test2 {
+ struct A { ~A(); char ***m; };
+ struct B : A { ~B(); };
+
+ B::~B() {}
+ // CHECK: define void @_ZN5test21BD2Ev
+ // CHECK: call void @_ZN5test21AD2Ev
+}
OpenPOWER on IntegriCloud