blob: 9e0593998bb3a4c3c378e541f2d04074d23c3b3c [file] [log] [blame]
Rafael Espindolaf3eaf452010-03-24 22:43:31 +00001// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2
3// CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant
4// CHECK: @_ZTVN5test018stdio_sync_filebufIwEE = constant
5
6// CHECK: define linkonce_odr void @_ZN5test21CIiEC1Ev(
7// CHECK: define linkonce_odr void @_ZN5test21CIiE6foobarIdEEvT_(
8// CHECK: define available_externally void @_ZN5test21CIiE6zedbarEd(
9
10namespace test0 {
11 struct basic_streambuf {
12 virtual ~basic_streambuf();
13 };
14 template<typename _CharT >
15 struct stdio_sync_filebuf : public basic_streambuf {
16 virtual void xsgetn();
17 };
18
19 // This specialization should cause the vtable to be emitted, even with
20 // the following extern template declaration.
21 template<> void stdio_sync_filebuf<wchar_t>::xsgetn() {
22 }
23 extern template class stdio_sync_filebuf<wchar_t>;
24}
25
26namespace test1 {
27 struct basic_streambuf {
28 virtual ~basic_streambuf();
29 };
30 template<typename _CharT >
31 struct stdio_sync_filebuf : public basic_streambuf {
32 virtual void xsgetn();
33 };
34
35 // Just a declaration should not force the vtable to be emitted.
36 template<> void stdio_sync_filebuf<wchar_t>::xsgetn();
37}
38
39namespace test2 {
40 template<typename T1>
41 class C {
42 virtual ~C();
43 void zedbar(double) {
44 }
45 template<typename T2>
46 void foobar(T2 foo) {
47 }
48 };
49 extern template class C<int>;
50 void g() {
51 // The extern template declaration should not prevent us from producing
52 // the implicit constructor (test at the top).
53 C<int> a;
54
55 // or foobar(test at the top).
56 a.foobar(0.0);
57
58 // But it should prevent zebbar
59 // (test at the top).
60 a.zedbar(0.0);
61 }
62}