1 // RUN: %clang_cc1 -emit-llvm -triple i686-pc-linux-gnu -o - %s | FileCheck %s 2 3 // This check logically is attached to 'template int S<int>::i;' below. 4 // CHECK: @_ZN1SIiE1iE = weak_odr global i32 5 6 template<typename T, typename U, typename Result> 7 struct plus { 8 Result operator()(const T& t, const U& u) const; 9 }; 10 11 template<typename T, typename U, typename Result> 12 Result plus<T, U, Result>::operator()(const T& t, const U& u) const { 13 return t + u; 14 } 15 16 // CHECK: define weak_odr i32 @_ZNK4plusIillEclERKiRKl 17 template struct plus<int, long, long>; 18 19 // Check that we emit definitions from explicit instantiations even when they 20 // occur prior to the definition itself. 21 template <typename T> struct S { 22 void f(); 23 static void g(); 24 static int i; 25 struct S2 { 26 void h(); 27 }; 28 }; 29 30 // CHECK: define weak_odr void @_ZN1SIiE1fEv 31 template void S<int>::f(); 32 33 // CHECK: define weak_odr void @_ZN1SIiE1gEv 34 template void S<int>::g(); 35 36 // See the check line at the top of the file. 37 template int S<int>::i; 38 39 // CHECK: define weak_odr void @_ZN1SIiE2S21hEv 40 template void S<int>::S2::h(); 41 42 template <typename T> void S<T>::f() {} 43 template <typename T> void S<T>::g() {} 44 template <typename T> int S<T>::i; 45 template <typename T> void S<T>::S2::h() {} 46