// RUN: %clang_cc1 -emit-llvm -triple i686-pc-linux-gnu -o - %s | FileCheck %s // This check logically is attached to 'template int S::i;' below. // CHECK: @_ZN1SIiE1iE = weak_odr global i32 template struct plus { Result operator()(const T& t, const U& u) const; }; template Result plus::operator()(const T& t, const U& u) const { return t + u; } // CHECK: define weak_odr i32 @_ZNK4plusIillEclERKiRKl template struct plus; // Check that we emit definitions from explicit instantiations even when they // occur prior to the definition itself. template struct S { void f(); static void g(); static int i; struct S2 { void h(); }; }; // CHECK: define weak_odr void @_ZN1SIiE1fEv template void S::f(); // CHECK: define weak_odr void @_ZN1SIiE1gEv template void S::g(); // See the check line at the top of the file. template int S::i; // CHECK: define weak_odr void @_ZN1SIiE2S21hEv template void S::S2::h(); template void S::f() {} template void S::g() {} template int S::i; template void S::S2::h() {}