diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-04-30 17:10:18 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-04-30 17:10:18 +0000 |
commit | 92fc0178c61db0fa9a9f52b4873fa366e47f658c (patch) | |
tree | 4cc38cce0458b874203d8727009b6bad1abd48c8 /clang/test | |
parent | 553e5ebe4a79836a462a872609913174280a9255 (diff) | |
download | bcm5719-llvm-92fc0178c61db0fa9a9f52b4873fa366e47f658c.tar.gz bcm5719-llvm-92fc0178c61db0fa9a9f52b4873fa366e47f658c.zip |
__thread: Move constant init check to CheckCompleteVariableDeclaration
We were emitting dynamic initializers for __thread variables if there
was no explicit initializer, as in this test case:
struct S { S(); };
__thread S s;
llvm-svn: 207675
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/thread-specifier.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Sema/thread-specifier.c b/clang/test/Sema/thread-specifier.c index 39243d1a760..d49b350667a 100644 --- a/clang/test/Sema/thread-specifier.c +++ b/clang/test/Sema/thread-specifier.c @@ -107,4 +107,17 @@ __thread S s; #endif #endif +#ifdef __cplusplus +struct HasCtor { + HasCtor(); +}; +__thread HasCtor var_with_ctor; +#if !defined(CXX11) +// expected-error@-2 {{initializer for thread-local variable must be a constant expression}} +#if __cplusplus >= 201103L +// expected-note@-4 {{use 'thread_local' to allow this}} +#endif +#endif +#endif + __thread int aggregate[10] = {0}; |