diff options
author | Hans Wennborg <hans@hanshq.net> | 2012-08-29 08:44:49 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2012-08-29 08:44:49 +0000 |
commit | ae7a66f44edebe14d0499d790e91e3ef57e1f70e (patch) | |
tree | c69d1bfa43bbe3228708cff409b1c39856cd91f9 /test/Sema/init.c | |
parent | 3bd27857bc9641821d29c78826e069f4108d73a3 (diff) |
The address of a TLS var is not compile-time constant (PR13720)
This makes Clang produce an error for code such as:
__thread int x;
int *p = &x;
The lvalue of a thread-local variable cannot be evaluated at compile
time.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162835 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/init.c')
-rw-r--r-- | test/Sema/init.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/Sema/init.c b/test/Sema/init.c index 81a665dc62..ee3e256b58 100644 --- a/test/Sema/init.c +++ b/test/Sema/init.c @@ -157,3 +157,10 @@ int PR4386_zed() __attribute((weak)); typedef char strty[10]; struct vortexstruct { strty s; }; struct vortexstruct vortexvar = { "asdf" }; + +// PR13720 +__thread int thread_int; +int *thread_int_ptr = &thread_int; // expected-error{{initializer element is not a compile-time constant}} +void f() { + int *p = &thread_int; // This is perfectly fine, though. +} |