1// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -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;
13public:
14  S2():a(0) { }
15  S2 & operator =(S2 &s2) { return *this; }
16};
17class S3 {
18  int a;
19public:
20  S3():a(0) { }
21  S3 &operator =(S3 &s3) { return *this; }
22};
23class S4 {
24  int a;
25  S4();
26  S4 &operator =(const S4 &s4); // expected-note {{implicitly declared private here}}
27public:
28  S4(int v):a(v) { }
29};
30class S5 {
31  int a;
32  S5():a(0) {}
33  S5 &operator =(const S5 &s5) { return *this; } // expected-note {{implicitly declared private here}}
34public:
35  S5(int v):a(v) { }
36};
37template <class T>
38class ST {
39public:
40  static T s;
41};
42
43namespace A {
44double x;
45#pragma omp threadprivate(x)
46}
47namespace B {
48using A::x;
49}
50
51S2 k;
52S3 h;
53S4 l(3);
54S5 m(4);
55#pragma omp threadprivate(h, k, l, m)
56
57int main(int argc, char **argv) {
58  int i;
59  #pragma omp parallel copyin // expected-error {{expected '(' after 'copyin'}}
60  #pragma omp parallel copyin ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
61  #pragma omp parallel copyin () // expected-error {{expected expression}}
62  #pragma omp parallel copyin (k // expected-error {{expected ')'}} expected-note {{to match this '('}}
63  #pragma omp parallel copyin (h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
64  #pragma omp parallel copyin (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
65  #pragma omp parallel copyin (l) // expected-error {{'operator=' is a private member of 'S4'}}
66  #pragma omp parallel copyin (S1) // expected-error {{'S1' does not refer to a value}}
67  #pragma omp parallel copyin (argv[1]) // expected-error {{expected variable name}}
68  #pragma omp parallel copyin(i) // expected-error {{copyin variable must be threadprivate}}
69  #pragma omp parallel copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
70  #pragma omp parallel copyin(ST<int>::s) // expected-error {{copyin variable must be threadprivate}}
71  #pragma omp parallel copyin(B::x)
72  foo();
73
74  return 0;
75}
76