Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / g++.dg / tls / thread_local2g.C
1 // { dg-do run }
2 // { dg-options "-std=c++11" }
3 // { dg-add-options tls }
4 // { dg-require-effective-target tls_runtime }
5
6 extern "C" void abort();
7
8 struct A
9 {
10   A();
11   int i;
12 };
13
14 thread_local A a;
15
16 A &f()
17 {
18   return a;
19 }
20
21 int j;
22 A::A(): i(j) { }
23
24 int main()
25 {
26   j = 42;
27   if (f().i != 42)
28     abort ();
29 }