| 1 |
// Valid __thread specifiers. |
| 2 |
// { dg-require-effective-target tls } |
| 3 |
|
| 4 |
__thread int g1; |
| 5 |
extern __thread int g2; |
| 6 |
static __thread int g3; |
| 7 |
|
| 8 |
void foo() |
| 9 |
{ |
| 10 |
extern __thread int l1; |
| 11 |
static __thread int l2; |
| 12 |
} |
| 13 |
|
| 14 |
struct A { |
| 15 |
static __thread int i; |
| 16 |
}; |
| 17 |
|
| 18 |
__thread int A::i = 42; |
| 19 |
|
| 20 |
template <typename T> struct B { |
| 21 |
static __thread T t; |
| 22 |
}; |
| 23 |
|
| 24 |
template <typename T> |
| 25 |
__thread T B<T>::t = 42; |
| 26 |
|
| 27 |
void bar () |
| 28 |
{ |
| 29 |
int j = B<int>::t; |
| 30 |
int k = B<const int>::t; |
| 31 |
} |