p14.cpp revision 060ddb0173ba91cd400f073ed0bd1f9b9c3a4d50
1// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
2
3template<class T> void f(T) { /* ... */ }
4template<class T> inline void g(T) { /* ... */ }
5
6// CHECK: define void @_Z1gIiEvT_
7template<> void g<>(int) { /* ... */ }
8
9template<class T>
10struct X {
11  void f() { }
12  void g();
13  void h();
14};
15
16template<class T>
17void X<T>::g() {
18}
19
20template<class T>
21inline void X<T>::h() {
22}
23
24// CHECK: define void @_ZN1XIiE1fEv
25template<> void X<int>::f() { }
26
27// CHECK: define void @_ZN1XIiE1hEv
28template<> void X<int>::h() { }
29
30// CHECK: define linkonce_odr void @_Z1fIiEvT_
31template<> inline void f<>(int) { /* ... */ }
32
33// CHECK: define linkonce_odr void @_ZN1XIiE1gEv
34template<> inline void X<int>::g() { }
35
36void test(X<int> xi) {
37  f(17);
38  g(17);
39  xi.f();
40  xi.g();
41  xi.h();
42}
43