summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gomp/tls-3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/gomp/tls-3.C')
-rw-r--r--gcc/testsuite/g++.dg/gomp/tls-3.C27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/gomp/tls-3.C b/gcc/testsuite/g++.dg/gomp/tls-3.C
new file mode 100644
index 000000000..c710b6d18
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/tls-3.C
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-require-effective-target tls }
+
+#define thr threadprivate
+
+int i;
+#pragma omp thr (i)
+namespace N
+{
+ int j;
+#pragma omp thr (j)
+};
+struct S
+{
+ static int s;
+#pragma omp thr (s)
+};
+
+int S::s = 5;
+
+int
+foo ()
+{
+ static int k;
+#pragma omp thr (k)
+ return k++ + S::s;
+}