diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-07-17 23:36:49 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-07-17 23:36:49 +0000 |
commit | 3daaf3ddc5887622a8f64147a75512b65e97a1fd (patch) | |
tree | 344bc100e8dc263407721d31d7bbfb1a7f5d8078 /test/CodeGenCXX/microsoft-compatibility.cpp | |
parent | 92d5b410b91b093f40af0a07d0cda0ded28ba3db (diff) |
[MS ABI] Explicit specialization of static data members are weak
Normally, explicit specializations are treated like strong external
definitions. However, MSVC treats explicit specializations of static
data members as weak. MSVC 2013's <regex> implementation has such an
explicit specialization which leads to clang emitting a strong
definition in each translation unit which includes it. Tweak clang's
linkage calculation to give such entities GVA_StrongODR linkage instead.
This fixes PR24165.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/microsoft-compatibility.cpp')
-rw-r--r-- | test/CodeGenCXX/microsoft-compatibility.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CodeGenCXX/microsoft-compatibility.cpp b/test/CodeGenCXX/microsoft-compatibility.cpp index 297184a1df..36760243d4 100644 --- a/test/CodeGenCXX/microsoft-compatibility.cpp +++ b/test/CodeGenCXX/microsoft-compatibility.cpp @@ -1,5 +1,15 @@ // RUN: %clang_cc1 %s -triple i686-pc-win32 -std=c++11 -fms-compatibility -emit-llvm -o - | FileCheck %s +template <typename> +struct S { + static const int x[]; +}; + +template <> +const int S<char>::x[] = {1}; + +// CHECK-LABEL: @"\01?x@?$S@D@@2QBHB" = weak_odr constant [1 x i32] [i32 1], comdat + template<class T> void destroy(T *p) { p->~T(); |