diff options
author | Anders Carlsson <andersca@mac.com> | 2011-02-03 02:08:44 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-02-03 02:08:44 +0000 |
commit | aedd9d5ad3cc776fd61457050bcd54cac4c5ea66 (patch) | |
tree | e87d32a8c47c8825b7774c82088568999cb01285 /test/CodeGenCXX/vtable-available-externally.cpp | |
parent | b51eee43676c2f4b7c4e1fa1648b438051b2b098 (diff) |
Don't try to mark virtual members referenced for classes where the key function
is not defined in the current translation unit. Doing so lead to compile errors
such as PR9114.
Instead, when CodeGen is building the vtable, don't try to emit a definition
for functions that aren't marked used in the current translation unit.
Fixes PR9114.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124768 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-available-externally.cpp')
-rw-r--r-- | test/CodeGenCXX/vtable-available-externally.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-available-externally.cpp b/test/CodeGenCXX/vtable-available-externally.cpp index b6e48c8f8c..11c1abda4b 100644 --- a/test/CodeGenCXX/vtable-available-externally.cpp +++ b/test/CodeGenCXX/vtable-available-externally.cpp @@ -53,3 +53,51 @@ namespace Test2 { void A::f() { } } + +// Test that we don't assert on this test. +namespace Test3 { + +struct A { + virtual void f(); + virtual ~A() { } +}; + +struct B : A { + B(); + virtual void f(); +}; + +B::B() { } + +void g(A* a) { + a->f(); +}; + +} + +// PR9114, test that we don't try to emit a definition of +namespace Test4 { + +template <class T> struct RefPtr { + T* p; + ~RefPtr() { + p->deref(); + } +}; + +struct A { + virtual ~A(); +}; + +struct Node; + +struct B : A { + virtual void deref(); + RefPtr<Node> m; +}; + +void f() { + RefPtr<B> b; +} + +} |