aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/vtable-key-function.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-05 19:06:31 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-05 19:06:31 +0000
commitbd6d6197fcfc98356ea60e816365eb0648b69556 (patch)
treef917c297d0e6751c05d05a7bd4fca29581c99673 /test/CodeGenCXX/vtable-key-function.cpp
parentef372018c2dc0f8c2e5c34698401b87077eef6ed (diff)
Improve key-function computation for templates. In particular:
- All classes can have a key function; templates don't change that. non-template classes when computing the key function. - We always mark all of the virtual member functions of class template instantiations. - The vtable for an instantiation of a class template has weak linkage. We could probably use available_externally linkage for vtables of classes instantiated by explicit instantiation declarations (extern templates), but GCC doesn't do this and I'm not 100% that the ABI permits it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92753 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-key-function.cpp')
-rw-r--r--test/CodeGenCXX/vtable-key-function.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-key-function.cpp b/test/CodeGenCXX/vtable-key-function.cpp
index 90e8ea66f7..97a546f8c9 100644
--- a/test/CodeGenCXX/vtable-key-function.cpp
+++ b/test/CodeGenCXX/vtable-key-function.cpp
@@ -13,3 +13,21 @@ struct A {
A::A() { }
A::A(int) { }
}
+
+// Make sure that we don't assert when building the vtable for a class
+// template specialization or explicit instantiation with a key
+// function.
+template<typename T>
+struct Base {
+ virtual ~Base();
+};
+
+template<typename T>
+struct Derived : public Base<T> { };
+
+template<>
+struct Derived<char> : public Base<char> {
+ virtual void anchor();
+};
+
+void Derived<char>::anchor() { }