1// RUN: %clang_cc1 -verify -fopenmp -o - %s
2
3void foo() {
4}
5
6bool foobool(int argc) {
7  return argc;
8}
9
10struct S1; // expected-note {{declared here}}
11class S2 {
12  mutable int a;
13
14public:
15  S2() : a(0) {}
16  S2 &operator=(S2 &s2) { return *this; }
17};
18class S3 {
19  int a;
20
21public:
22  S3() : a(0) {}
23  S3 &operator=(S3 &s3) { return *this; }
24};
25class S4 {
26  int a;
27  S4();
28  S4 &operator=(const S4 &s4); // expected-note {{implicitly declared private here}}
29
30public:
31  S4(int v) : a(v) {}
32};
33class S5 {
34  int a;
35  S5() : a(0) {}
36  S5 &operator=(const S5 &s5) { return *this; } // expected-note {{implicitly declared private here}}
37
38public:
39  S5(int v) : a(v) {}
40};
41template <class T>
42class ST {
43public:
44  static T s;
45};
46
47S2 k;
48S3 h;
49S4 l(3);
50S5 m(4);
51#pragma omp threadprivate(h, k, l, m)
52
53namespace A {
54double x;
55#pragma omp threadprivate(x)
56}
57namespace B {
58using A::x;
59}
60
61int main(int argc, char **argv) {
62  int i;
63#pragma omp parallel for simd copyin // expected-error {{expected '(' after 'copyin'}}
64  for (i = 0; i < argc; ++i)
65    foo();
66#pragma omp parallel for simd copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
67  for (i = 0; i < argc; ++i)
68    foo();
69#pragma omp parallel for simd copyin() // expected-error {{expected expression}}
70  for (i = 0; i < argc; ++i)
71    foo();
72#pragma omp parallel for simd copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}
73  for (i = 0; i < argc; ++i)
74    foo();
75#pragma omp parallel for simd copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
76  for (i = 0; i < argc; ++i)
77    foo();
78#pragma omp parallel for simd copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
79  for (i = 0; i < argc; ++i)
80    foo();
81#pragma omp parallel for simd copyin(l) // expected-error {{'operator=' is a private member of 'S4'}}
82  for (i = 0; i < argc; ++i)
83    foo();
84#pragma omp parallel for simd copyin(S1) // expected-error {{'S1' does not refer to a value}}
85  for (i = 0; i < argc; ++i)
86    foo();
87#pragma omp parallel for simd copyin(argv[1]) // expected-error {{expected variable name}}
88  for (i = 0; i < argc; ++i)
89    foo();
90#pragma omp parallel for simd copyin(i) // expected-error {{copyin variable must be threadprivate}}
91  for (i = 0; i < argc; ++i)
92    foo();
93#pragma omp parallel for simd copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
94  for (i = 0; i < argc; ++i)
95    foo();
96#pragma omp parallel for simd copyin(ST < int > ::s, B::x) // expected-error {{copyin variable must be threadprivate}}
97  for (i = 0; i < argc; ++i)
98    foo();
99
100  return 0;
101}
102