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