diff options
Diffstat (limited to 'clang/test/SemaCXX/dllimport.cpp')
| -rw-r--r-- | clang/test/SemaCXX/dllimport.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/dllimport.cpp b/clang/test/SemaCXX/dllimport.cpp index 2fa10756da4..f17c2e22414 100644 --- a/clang/test/SemaCXX/dllimport.cpp +++ b/clang/test/SemaCXX/dllimport.cpp @@ -93,6 +93,18 @@ __declspec(dllimport) auto InternalAutoTypeGlobal = Internal(); // expected-erro // Thread local variables are invalid. __declspec(dllimport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllimport'}} +inline void InlineWithThreadLocal() { + static __declspec(dllimport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllimport'}} +} + +// But if they're in a dllimported function, it's OK because we will not inline the function. +// This doesn't work on MinGW, because there, dllimport on the inline function is ignored. +#ifndef GNU +inline void __declspec(dllimport) ImportedInlineWithThreadLocal() { + static __declspec(dllimport) __thread int OK1; // no-error + static __thread int OK2; // no-error +} +#endif // Import in local scope. __declspec(dllimport) float LocalRedecl1; // expected-note{{previous declaration is here}} |

