blob: a9e4513b1647f520a88252966b35ca261d0e80d3 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
Anders Carlssond58987c2009-12-07 07:59:52 +00002// PR5697
3namespace PR5697 {
4struct 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.)
Rafael Espindola9f959db2011-01-11 21:10:26 +000012// CHECK: @_ZTVN6PR56971AE = weak_odr unnamed_addr constant
Anders Carlssond58987c2009-12-07 07:59:52 +000013A::A() { }
14A::A(int) { }
15}
Douglas Gregorbd6d6192010-01-05 19:06:31 +000016
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.
20template<typename T>
21struct Base {
22 virtual ~Base();
23};
24
25template<typename T>
26struct Derived : public Base<T> { };
27
28template<>
29struct Derived<char> : public Base<char> {
30 virtual void anchor();
31};
32
33void Derived<char>::anchor() { }