1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2template<typename T> struct A {
3  virtual void f(T) { }
4  inline void g() { }
5};
6
7// Explicit instantiations have external linkage.
8
9// CHECK: define weak_odr void @_ZN1AIiE1gEv(
10template void A<int>::g();
11
12// CHECK: define weak_odr void @_ZN1AIfE1fEf(
13// CHECK: define weak_odr void @_ZN1AIfE1gEv(
14// FIXME: This should also emit the vtable.
15template struct A<float>;
16
17// CHECK: define weak_odr void @_Z1fIiEvT_
18template <typename T> void f(T) { }
19template void f<int>(int);
20
21// CHECK: define weak_odr void @_Z1gIiEvT_
22template <typename T> inline void g(T) { }
23template void g<int>(int);
24
25template<typename T>
26struct X0 {
27  virtual ~X0() { }
28};
29
30template<typename T>
31struct X1 : X0<T> {
32  virtual void blarg();
33};
34
35template<typename T> void X1<T>::blarg() { }
36
37extern template struct X0<char>;
38extern template struct X1<char>;
39
40// CHECK: define linkonce_odr void @_ZN2X1IcED1Ev(%struct.X1* %this) unnamed_addr
41void test_X1() {
42  X1<char> i1c;
43}
44
45