blob: d8a34bad21ba607d7cf7236fb810d913357b2837 [file] [log] [blame]
Alexey Bataevdb390212015-05-20 04:24:19 +00001// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
Alexey Bataev84d0b3e2014-07-08 08:12:03 +00002
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};
Alexey Bataevf56f98c2015-04-16 05:39:01 +000025class S4 {
Alexey Bataev84d0b3e2014-07-08 08:12:03 +000026 int a;
27 S4();
Alexey Bataevf56f98c2015-04-16 05:39:01 +000028 S4 &operator=(const S4 &s4); // expected-note {{implicitly declared private here}}
Alexey Bataev84d0b3e2014-07-08 08:12:03 +000029
30public:
31 S4(int v) : a(v) {}
32};
Alexey Bataevf56f98c2015-04-16 05:39:01 +000033class S5 {
Alexey Bataev84d0b3e2014-07-08 08:12:03 +000034 int a;
35 S5() : a(0) {}
Alexey Bataevf56f98c2015-04-16 05:39:01 +000036 S5 &operator=(const S5 &s5) { return *this; } // expected-note {{implicitly declared private here}}
Alexey Bataev84d0b3e2014-07-08 08:12:03 +000037
38public:
39 S5(int v) : a(v) {}
40};
41template <class T>
42class ST {
43public:
44 static T s;
45};
46
47S2 k;
48S3 h;
Alexey Bataevf56f98c2015-04-16 05:39:01 +000049S4 l(3);
50S5 m(4);
Alexey Bataev84d0b3e2014-07-08 08:12:03 +000051#pragma omp threadprivate(h, k, l, m)
52
Alexey Bataev6ddfe1a2015-04-16 13:49:42 +000053namespace A {
54double x;
55#pragma omp threadprivate(x)
56}
57namespace B {
58using A::x;
59}
60
Alexey Bataev84d0b3e2014-07-08 08:12:03 +000061int main(int argc, char **argv) {
62 int i;
63#pragma omp parallel sections copyin // expected-error {{expected '(' after 'copyin'}}
64 {
65 foo();
66 }
67#pragma omp parallel sections copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
68 {
69 foo();
70 }
71#pragma omp parallel sections copyin() // expected-error {{expected expression}}
72 {
73 foo();
74 }
75#pragma omp parallel sections copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}
76 {
77 foo();
78 }
Alexey Bataev05968172016-03-31 09:13:44 +000079#pragma omp parallel sections copyin(h, // expected-error {{expected ')'}} expected-note {{to match this '('}}
Alexey Bataev84d0b3e2014-07-08 08:12:03 +000080 {
81 foo();
82 }
83#pragma omp parallel sections copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
84 {
85 foo();
86 }
Alexey Bataevf56f98c2015-04-16 05:39:01 +000087#pragma omp parallel sections copyin(l) // expected-error {{'operator=' is a private member of 'S4'}}
Alexey Bataev84d0b3e2014-07-08 08:12:03 +000088 {
89 foo();
90 }
91#pragma omp parallel sections copyin(S1) // expected-error {{'S1' does not refer to a value}}
92 {
93 foo();
94 }
95#pragma omp parallel sections copyin(argv[1]) // expected-error {{expected variable name}}
96 {
97 foo();
98 }
99#pragma omp parallel sections copyin(i) // expected-error {{copyin variable must be threadprivate}}
100 {
101 foo();
102 }
Alexey Bataevf56f98c2015-04-16 05:39:01 +0000103#pragma omp parallel sections copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000104 {
105 foo();
106 }
Alexey Bataev6ddfe1a2015-04-16 13:49:42 +0000107#pragma omp parallel sections copyin(ST < int > ::s, B::x) // expected-error {{copyin variable must be threadprivate}}
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000108 {
109 foo();
110 }
111
112 return 0;
113}