diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /test/CodeGenCXX/template-instantiation.cpp | |
parent | 69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff) | |
download | FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz |
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'test/CodeGenCXX/template-instantiation.cpp')
-rw-r--r-- | test/CodeGenCXX/template-instantiation.cpp | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/test/CodeGenCXX/template-instantiation.cpp b/test/CodeGenCXX/template-instantiation.cpp index cb6c812..635e1d2 100644 --- a/test/CodeGenCXX/template-instantiation.cpp +++ b/test/CodeGenCXX/template-instantiation.cpp @@ -2,9 +2,12 @@ // CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant // CHECK-NOT: _ZTVN5test315basic_fstreamXXIcEE -// CHECK: @_ZTVN5test018stdio_sync_filebufIwEE = constant +// CHECK: @_ZTVN5test018stdio_sync_filebufIwEE = unnamed_addr constant -// CHECK: define linkonce_odr void @_ZN5test21CIiEC1Ev( +// CHECK-NOT: _ZTVN5test31SIiEE +// CHECK-NOT: _ZTSN5test31SIiEE + +// CHECK: define linkonce_odr void @_ZN5test21CIiEC1Ev(%"class.test2::C"* nocapture %this) unnamed_addr // CHECK: define linkonce_odr void @_ZN5test21CIiE6foobarIdEEvT_( // CHECK: define available_externally void @_ZN5test21CIiE6zedbarEd( @@ -75,3 +78,47 @@ namespace test3 { // (test at the top). template void basic_fstreamXX<char>::is_open() const; } + +namespace test3 { + template <typename T> + struct S { + virtual void m(); + }; + + template<typename T> + void S<T>::m() { } + + // Should not cause us to produce vtable because template instantiations + // don't have key functions. + template void S<int>::m(); +} + +namespace test4 { + template <class T> struct A { static void foo(); }; + + class B { + template <class T> friend void A<T>::foo(); + B(); + }; + + template <class T> void A<T>::foo() { + B b; + } + + unsigned test() { + A<int>::foo(); + } +} + +namespace PR8505 { +// Hits an assertion due to bogus instantiation of class B. +template <int i> class A { + class B* g; +}; +class B { + void f () {} +}; +// Should not instantiate class B since it is introduced in namespace scope. +// CHECK-NOT: _ZN6PR85051AILi0EE1B1fEv +template class A<0>; +} |