From 36c49e3f258dced101949edabd72e9bc3f1dedc4 Mon Sep 17 00:00:00 2001 From: dim Date: Fri, 17 Sep 2010 15:54:40 +0000 Subject: Vendor import of clang r114020 (from the release_28 branch): http://llvm.org/svn/llvm-project/cfe/branches/release_28@114020 Approved by: rpaulo (mentor) --- test/CodeGenCXX/explicit-instantiation.cpp | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/CodeGenCXX/explicit-instantiation.cpp') diff --git a/test/CodeGenCXX/explicit-instantiation.cpp b/test/CodeGenCXX/explicit-instantiation.cpp index 24d1a67..b829585 100644 --- a/test/CodeGenCXX/explicit-instantiation.cpp +++ b/test/CodeGenCXX/explicit-instantiation.cpp @@ -1,5 +1,8 @@ // 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 global i32 + template struct plus { Result operator()(const T& t, const U& u) const; @@ -12,3 +15,31 @@ Result plus::operator()(const T& t, const U& u) const { // 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() {} -- cgit v1.1