Daily bump.
[official-gcc.git] / gcc / testsuite / g++.dg / tls / thread_local3g.C
blob2f9fdee1a73db24a67e92513930bad88e1f98709
1 // { dg-do run }
2 // { dg-require-effective-target c++11 }
3 // { dg-require-effective-target tls_runtime }
4 // { dg-require-effective-target pthread }
5 // { dg-require-cxa-atexit "" }
6 // { dg-options -pthread }
7 // { dg-add-options tls }
9 int c;
10 int d;
11 struct A
13   A() { ++c; }
14   ~A() { ++d; }
17 thread_local A a;
19 void *thread_main(void *)
21   A* ap = &a;
22   return 0;
25 #include <pthread.h>
27 int main()
29   pthread_t thread;
30   pthread_create (&thread, 0, thread_main, 0);
31   pthread_join(thread, 0);
32   pthread_create (&thread, 0, thread_main, 0);
33   pthread_join(thread, 0);
35   if (c != 2 || d != 2)
36     __builtin_abort();