1060ddb0173ba91cd400f073ed0bd1f9b9c3a4d50Nuno Lopes// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
227c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
327c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<class T> void f(T) { /* ... */ }
427c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<class T> inline void g(T) { /* ... */ }
527c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
627c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor// CHECK: define void @_Z1gIiEvT_
727c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<> void g<>(int) { /* ... */ }
827c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
927c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<class T>
1027c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregorstruct X {
1127c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor  void f() { }
1227c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor  void g();
1327c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor  void h();
1427c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor};
1527c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
1627c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<class T>
1727c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregorvoid X<T>::g() {
1827c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor}
1927c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
2027c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<class T>
2127c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregorinline void X<T>::h() {
2227c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor}
2327c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
2427c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor// CHECK: define void @_ZN1XIiE1fEv
2527c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<> void X<int>::f() { }
2627c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
2727c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor// CHECK: define void @_ZN1XIiE1hEv
2827c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<> void X<int>::h() { }
2927c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
3027c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor// CHECK: define linkonce_odr void @_Z1fIiEvT_
3127c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<> inline void f<>(int) { /* ... */ }
3227c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
3327c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor// CHECK: define linkonce_odr void @_ZN1XIiE1gEv
3427c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregortemplate<> inline void X<int>::g() { }
3527c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor
3627c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregorvoid test(X<int> xi) {
3727c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor  f(17);
3827c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor  g(17);
3927c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor  xi.f();
4027c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor  xi.g();
4127c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor  xi.h();
4227c8235def85fc7f92fcaffe7907eef0552ca209Douglas Gregor}
43