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