diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-10-26 22:47:47 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-10-26 22:47:47 +0000 |
commit | 92d835a86ac334768d0b75936201e4fea3941c1f (patch) | |
tree | 075b0167ae03efb9e84a9c57a4c3a8915ea97b45 /test/CodeGenCXX/specialized-static-data-mem-init.cpp | |
parent | 789a1597250e57d7f35f253467165913c68979ad (diff) |
Patch to provide guard when initializing instances
of static data member of a class template.
Fixes //rdar :// 8562966 and pr8409.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/specialized-static-data-mem-init.cpp')
-rw-r--r-- | test/CodeGenCXX/specialized-static-data-mem-init.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/CodeGenCXX/specialized-static-data-mem-init.cpp b/test/CodeGenCXX/specialized-static-data-mem-init.cpp new file mode 100644 index 0000000000..8f5765bcbb --- /dev/null +++ b/test/CodeGenCXX/specialized-static-data-mem-init.cpp @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// rdar: // 8562966 +// pr8409 + +// CHECK: @_ZN1CIiE11needs_guardE = weak global +// CHECK: @_ZGVN1CIiE11needs_guardE = weak global + +struct K +{ + K(); + K(const K &); + ~K(); + void PrintNumK(); +}; + +template<typename T> +struct C +{ + void Go() { needs_guard.PrintNumK(); } + static K needs_guard; +}; + +template<typename T> K C<T>::needs_guard; + +void F() +{ + C<int>().Go(); +} + |