Debian Codegraph @

gcc/testsuite/g++.dg/tls/thread_local10.C

raw
1 // PR c++/58624
2
3 // { dg-do run { target c++11 } }
4 // { dg-add-options tls }
5 // { dg-require-effective-target tls_runtime }
6
7 int i;
8
9 template <typename> struct A
10 {
11 static thread_local int s;
12
13 A () { i = s; }
14 };
15
16 int f() { return 42; }
17 template <typename T> thread_local int A<T>::s = f();
18
19 int main () {
20 A<void> a;
21 if (i != 42)
22 __builtin_abort();
23 }