summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/dllexport.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-09-04 19:59:39 +0000
committerHans Wennborg <hans@hanshq.net>2015-09-04 19:59:39 +0000
commit5427a695453c85a45a0d92c892e3f3c25885fe18 (patch)
treebd529451f4b0943886d25fa11974d2cf16488647 /clang/test/SemaCXX/dllexport.cpp
parent0fccef6ac2fc87f4dd29a1d098723cd2869a09ab (diff)
downloadbcm5719-llvm-5427a695453c85a45a0d92c892e3f3c25885fe18.tar.gz
bcm5719-llvm-5427a695453c85a45a0d92c892e3f3c25885fe18.zip
Don't allow dllexport/import on static local variables
They might technically have external linkage, but it still doesn't make sense for the user to try and export such variables. This matches MSVC's and MinGW's behaviour. llvm-svn: 246864
Diffstat (limited to 'clang/test/SemaCXX/dllexport.cpp')
-rw-r--r--clang/test/SemaCXX/dllexport.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/clang/test/SemaCXX/dllexport.cpp b/clang/test/SemaCXX/dllexport.cpp
index c3f26aa3155..f7076fb8e86 100644
--- a/clang/test/SemaCXX/dllexport.cpp
+++ b/clang/test/SemaCXX/dllexport.cpp
@@ -71,14 +71,9 @@ __declspec(dllexport) auto ExternalAutoTypeGlobal = External();
// Thread local variables are invalid.
__declspec(dllexport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllexport'}}
-inline void InlineWithThreadLocal() {
- static __declspec(dllexport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllexport'}}
-}
-
-// But if they're in a dllexport function, it's ok, because they will never get imported.
+// But a static local TLS var in an export function is OK.
inline void __declspec(dllexport) ExportedInlineWithThreadLocal() {
- static __declspec(dllexport) __thread int OK1; // no-error
- static __thread int OK2; // no-error
+ static __thread int OK; // no-error
}
// Export in local scope.
OpenPOWER on IntegriCloud