1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print
4 // expected-no-diagnostics
5 
6 #ifndef HEADER
7 #define HEADER
8 
9 struct St{
10  int a;
11 };
12 
13 struct St1{
14  int a;
15  static int b;
16 // CHECK: static int b;
17 #pragma omp threadprivate(b)
18 // CHECK-NEXT: #pragma omp threadprivate(St1::b)
19 } d;
20 
21 int a, b;
22 // CHECK: int a;
23 // CHECK: int b;
24 #pragma omp threadprivate(a)
25 // CHECK-NEXT: #pragma omp threadprivate(a)
26 #pragma omp threadprivate(d, b)
27 // CHECK-NEXT: #pragma omp threadprivate(d,b)
28 
29 template <class T> T foo() {
30   static T v;
31   #pragma omp threadprivate(v)
32   return v;
33 }
34 //CHECK: template <class T = int> int foo() {
35 //CHECK-NEXT: static int v;
36 //CHECK-NEXT: #pragma omp threadprivate(v)
37 //CHECK: template <class T> T foo() {
38 //CHECK-NEXT: static T v;
39 //CHECK-NEXT: #pragma omp threadprivate(v)
40 
41 namespace ns{
42   int a;
43 }
44 // CHECK: namespace ns {
45 // CHECK-NEXT: int a;
46 // CHECK-NEXT: }
47 #pragma omp threadprivate(ns::a)
48 // CHECK-NEXT: #pragma omp threadprivate(ns::a)
49 
50 int main () {
51   static int a;
52 // CHECK: static int a;
53 #pragma omp threadprivate(a)
54 // CHECK-NEXT: #pragma omp threadprivate(a)
55   a=2;
56   return (foo<int>());
57 }
58 
59 #endif
60