| 1 |
// PR c++/79288 |
| 2 |
// { dg-do compile { target { nonpic || pie_enabled } } } |
| 3 |
// { dg-require-effective-target tls } |
| 4 |
// { dg-options "-O2" } |
| 5 |
// { dg-skip-if "VxWorks kernel tls model is local-exec" { vxworks_kernel } } |
| 6 |
// { dg-final { scan-assembler-not "@tpoff" { target i?86-*-* x86_64-*-* } } } |
| 7 |
|
| 8 |
struct S |
| 9 |
{ |
| 10 |
static __thread int *p; |
| 11 |
}; |
| 12 |
|
| 13 |
template <int N> |
| 14 |
struct T |
| 15 |
{ |
| 16 |
static __thread int *p; |
| 17 |
}; |
| 18 |
|
| 19 |
int * |
| 20 |
foo () |
| 21 |
{ |
| 22 |
return S::p; |
| 23 |
} |
| 24 |
|
| 25 |
int * |
| 26 |
bar () |
| 27 |
{ |
| 28 |
return T<0>::p; |
| 29 |
} |