gcc/testsuite/g++.dg/gomp/tls-3.C
raw| 1 | // { dg-do compile } |
| 2 | // { dg-require-effective-target tls } |
| 3 | |
| 4 | #define thr threadprivate |
| 5 | |
| 6 | int i; |
| 7 | #pragma omp thr (i) |
| 8 | namespace N |
| 9 | { |
| 10 | int j; |
| 11 | #pragma omp thr (j) |
| 12 | }; |
| 13 | struct S |
| 14 | { |
| 15 | static int s; |
| 16 | #pragma omp thr (s) |
| 17 | }; |
| 18 | |
| 19 | int S::s = 5; |
| 20 | |
| 21 | int |
| 22 | foo () |
| 23 | { |
| 24 | static int k; |
| 25 | #pragma omp thr (k) |
| 26 | return k++ + S::s; |
| 27 | } |