1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s 2 3 void foo() { 4 } 5 6 bool foobool(int argc) { 7 return argc; 8 } 9 10 struct S1; // expected-note 2 {{declared here}} 11 class S2 { 12 mutable int a; 13 14 public: 15 S2() : a(0) {} 16 S2 &operator=(S2 &s2) { return *this; } 17 }; 18 class S3 { 19 int a; 20 21 public: 22 S3() : a(0) {} 23 S3 &operator=(S3 &s3) { return *this; } 24 }; 25 class S4 { 26 int a; 27 S4(); 28 S4 &operator=(const S4 &s4); // expected-note 3 {{implicitly declared private here}} 29 30 public: 31 S4(int v) : a(v) {} 32 }; 33 class S5 { 34 int a; 35 S5() : a(0) {} 36 S5 &operator=(const S5 &s5) { return *this; } // expected-note 3 {{implicitly declared private here}} 37 38 public: 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); 50 S5 m(4); 51 #pragma omp threadprivate(h, k, l, m) 52 53 namespace A { 54 double x; 55 #pragma omp threadprivate(x) 56 } 57 namespace B { 58 using A::x; 59 } 60 61 template <class T, typename S, int N> 62 T tmain(T argc, S **argv) { 63 T i; 64 #pragma omp target 65 #pragma omp teams 66 #pragma omp distribute parallel for simd copyin // expected-error {{expected '(' after 'copyin'}} 67 for (i = 0; i < argc; ++i) 68 foo(); 69 #pragma omp target 70 #pragma omp teams 71 #pragma omp distribute parallel for simd copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 72 for (i = 0; i < argc; ++i) 73 foo(); 74 #pragma omp target 75 #pragma omp teams 76 #pragma omp distribute parallel for simd copyin() // expected-error {{expected expression}} 77 for (i = 0; i < argc; ++i) 78 foo(); 79 #pragma omp target 80 #pragma omp teams 81 #pragma omp distribute parallel for simd copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}} 82 for (i = 0; i < argc; ++i) 83 foo(); 84 #pragma omp target 85 #pragma omp teams 86 #pragma omp distribute parallel for simd copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 87 for (i = 0; i < argc; ++i) 88 foo(); 89 #pragma omp target 90 #pragma omp teams 91 #pragma omp distribute parallel for simd copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} 92 for (i = 0; i < argc; ++i) 93 foo(); 94 #pragma omp target 95 #pragma omp teams 96 #pragma omp distribute parallel for simd copyin(l) // expected-error 2 {{'operator=' is a private member of 'S4'}} 97 for (i = 0; i < argc; ++i) 98 foo(); 99 #pragma omp target 100 #pragma omp teams 101 #pragma omp distribute parallel for simd copyin(S1) // expected-error {{'S1' does not refer to a value}} 102 for (i = 0; i < argc; ++i) 103 foo(); 104 #pragma omp target 105 #pragma omp teams 106 #pragma omp distribute parallel for simd copyin(argv[1]) // expected-error {{expected variable name}} 107 for (i = 0; i < argc; ++i) 108 foo(); 109 #pragma omp target 110 #pragma omp teams 111 #pragma omp distribute parallel for simd copyin(i) // expected-error {{copyin variable must be threadprivate}} 112 for (i = 0; i < argc; ++i) 113 foo(); 114 #pragma omp target 115 #pragma omp teams 116 #pragma omp distribute parallel for simd copyin(m) // expected-error 2 {{'operator=' is a private member of 'S5'}} 117 for (i = 0; i < argc; ++i) 118 foo(); 119 #pragma omp target 120 #pragma omp teams 121 #pragma omp distribute parallel for simd copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}} 122 for (i = 0; i < argc; ++i) 123 foo(); 124 } 125 126 int main(int argc, char **argv) { 127 int i; 128 #pragma omp target 129 #pragma omp teams 130 #pragma omp distribute parallel for simd copyin // expected-error {{expected '(' after 'copyin'}} 131 for (i = 0; i < argc; ++i) 132 foo(); 133 #pragma omp target 134 #pragma omp teams 135 #pragma omp distribute parallel for simd copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 136 for (i = 0; i < argc; ++i) 137 foo(); 138 #pragma omp target 139 #pragma omp teams 140 #pragma omp distribute parallel for simd copyin() // expected-error {{expected expression}} 141 for (i = 0; i < argc; ++i) 142 foo(); 143 #pragma omp target 144 #pragma omp teams 145 #pragma omp distribute parallel for simd copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}} 146 for (i = 0; i < argc; ++i) 147 foo(); 148 #pragma omp target 149 #pragma omp teams 150 #pragma omp distribute parallel for simd copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 151 for (i = 0; i < argc; ++i) 152 foo(); 153 #pragma omp target 154 #pragma omp teams 155 #pragma omp distribute parallel for simd copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} 156 for (i = 0; i < argc; ++i) 157 foo(); 158 #pragma omp target 159 #pragma omp teams 160 #pragma omp distribute parallel for simd copyin(l) // expected-error {{'operator=' is a private member of 'S4'}} 161 for (i = 0; i < argc; ++i) 162 foo(); 163 #pragma omp target 164 #pragma omp teams 165 #pragma omp distribute parallel for simd copyin(S1) // expected-error {{'S1' does not refer to a value}} 166 for (i = 0; i < argc; ++i) 167 foo(); 168 #pragma omp target 169 #pragma omp teams 170 #pragma omp distribute parallel for simd copyin(argv[1]) // expected-error {{expected variable name}} 171 for (i = 0; i < argc; ++i) 172 foo(); 173 #pragma omp target 174 #pragma omp teams 175 #pragma omp distribute parallel for simd copyin(i) // expected-error {{copyin variable must be threadprivate}} 176 for (i = 0; i < argc; ++i) 177 foo(); 178 #pragma omp target 179 #pragma omp teams 180 #pragma omp distribute parallel for simd copyin(m) // expected-error {{'operator=' is a private member of 'S5'}} 181 for (i = 0; i < argc; ++i) 182 foo(); 183 #pragma omp target 184 #pragma omp teams 185 #pragma omp distribute parallel for simd copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}} 186 for (i = 0; i < argc; ++i) 187 foo(); 188 189 return tmain<int, char, 3>(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 3>' requested here}} 190 } 191