Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s |
Anders Carlsson | d58987c | 2009-12-07 07:59:52 +0000 | [diff] [blame] | 2 | // PR5697 |
| 3 | namespace PR5697 { |
| 4 | struct A { |
| 5 | virtual void f() { } |
| 6 | A(); |
| 7 | A(int); |
| 8 | }; |
| 9 | |
| 10 | // A does not have a key function, so the first constructor we emit should |
| 11 | // cause the vtable to be defined (without assertions.) |
Anders Carlsson | f502d93 | 2011-01-24 00:46:19 +0000 | [diff] [blame] | 12 | // CHECK: @_ZTVN6PR56971AE = linkonce_odr unnamed_addr constant |
Anders Carlsson | d58987c | 2009-12-07 07:59:52 +0000 | [diff] [blame] | 13 | A::A() { } |
| 14 | A::A(int) { } |
| 15 | } |
Douglas Gregor | bd6d619 | 2010-01-05 19:06:31 +0000 | [diff] [blame] | 16 | |
| 17 | // Make sure that we don't assert when building the vtable for a class |
| 18 | // template specialization or explicit instantiation with a key |
| 19 | // function. |
| 20 | template<typename T> |
| 21 | struct Base { |
| 22 | virtual ~Base(); |
| 23 | }; |
| 24 | |
| 25 | template<typename T> |
| 26 | struct Derived : public Base<T> { }; |
| 27 | |
| 28 | template<> |
| 29 | struct Derived<char> : public Base<char> { |
| 30 | virtual void anchor(); |
| 31 | }; |
| 32 | |
| 33 | void Derived<char>::anchor() { } |