Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 150 -o - %s |
| 2 | // RUN: %clang_cc1 -verify -fopenmp -std=c++98 -ferror-limit 150 -o - %s |
| 3 | // RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 150 -o - %s |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 4 | |
| 5 | void foo() { |
| 6 | } |
| 7 | |
| 8 | bool foobool(int argc) { |
| 9 | return argc; |
| 10 | } |
| 11 | |
| 12 | struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}} |
| 13 | extern S1 a; |
| 14 | class S2 { |
| 15 | mutable int a; |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 16 | S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 17 | |
| 18 | public: |
| 19 | S2() : a(0) {} |
| 20 | S2(S2 &s2) : a(s2.a) {} |
Alexey Bataev | dffa93a | 2015-12-10 08:20:58 +0000 | [diff] [blame] | 21 | static float S2s; // expected-note 2 {{static data member is predetermined as shared}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 22 | static const float S2sc; |
| 23 | }; |
| 24 | const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}} |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 25 | S2 b; // expected-note 3 {{'b' defined here}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 26 | const S2 ba[5]; // expected-note 2 {{'ba' defined here}} |
| 27 | class S3 { |
| 28 | int a; |
| 29 | |
| 30 | public: |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 31 | int b; |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 32 | S3() : a(0) {} |
| 33 | S3(const S3 &s3) : a(s3.a) {} |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 34 | S3 operator+(const S3 &arg1) { return arg1; } |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 35 | }; |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 36 | int operator+(const S3 &arg1, const S3 &arg2) { return 5; } |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 37 | S3 c; // expected-note 3 {{'c' defined here}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 38 | const S3 ca[5]; // expected-note 2 {{'ca' defined here}} |
| 39 | extern const int f; // expected-note 4 {{'f' declared here}} |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 40 | class S4 { |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 41 | int a; |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 42 | S4(); // expected-note {{implicitly declared private here}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 43 | S4(const S4 &s4); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 44 | S4 &operator+(const S4 &arg) { return (*this); } |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 45 | |
| 46 | public: |
| 47 | S4(int v) : a(v) {} |
| 48 | }; |
| 49 | S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; } |
| 50 | class S5 { |
| 51 | int a; |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 52 | S5() : a(0) {} // expected-note {{implicitly declared private here}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 53 | S5(const S5 &s5) : a(s5.a) {} |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 54 | S5 &operator+(const S5 &arg); |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 55 | |
| 56 | public: |
| 57 | S5(int v) : a(v) {} |
| 58 | }; |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 59 | class S6 { // expected-note 3 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} |
Charles Li | e7cbb3e | 2015-11-17 20:25:05 +0000 | [diff] [blame] | 60 | #if __cplusplus >= 201103L // C++11 or later |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 61 | // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}} |
Charles Li | e7cbb3e | 2015-11-17 20:25:05 +0000 | [diff] [blame] | 62 | #endif |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 63 | int a; |
| 64 | |
| 65 | public: |
| 66 | S6() : a(6) {} |
| 67 | operator int() { return 6; } |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 68 | } o; |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 69 | |
| 70 | S3 h, k; |
| 71 | #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} |
| 72 | |
| 73 | template <class T> // expected-note {{declared here}} |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 74 | T tmain(T argc) { |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 75 | const T d = T(); // expected-note 4 {{'d' defined here}} |
| 76 | const T da[5] = {T()}; // expected-note 2 {{'da' defined here}} |
| 77 | T qa[5] = {T()}; |
| 78 | T i; |
| 79 | T &j = i; // expected-note 4 {{'j' defined here}} |
| 80 | S3 &p = k; // expected-note 2 {{'p' defined here}} |
| 81 | const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}} |
| 82 | T &q = qa[(int)i]; // expected-note 2 {{'q' defined here}} |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 83 | T fl; |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 84 | #pragma omp parallel sections reduction // expected-error {{expected '(' after 'reduction'}} |
| 85 | { |
| 86 | foo(); |
| 87 | } |
| 88 | #pragma omp parallel sections reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 89 | { |
| 90 | foo(); |
| 91 | } |
| 92 | #pragma omp parallel sections reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 93 | { |
| 94 | foo(); |
| 95 | } |
| 96 | #pragma omp parallel sections reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 97 | { |
| 98 | foo(); |
| 99 | } |
| 100 | #pragma omp parallel sections reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} |
| 101 | { |
| 102 | foo(); |
| 103 | } |
| 104 | #pragma omp parallel sections reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} |
| 105 | { |
| 106 | foo(); |
| 107 | } |
| 108 | #pragma omp parallel sections reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} |
| 109 | { |
| 110 | foo(); |
| 111 | } |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 112 | #pragma omp parallel sections reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 113 | { |
| 114 | foo(); |
| 115 | } |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 116 | #pragma omp parallel sections reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 117 | { |
| 118 | foo(); |
| 119 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 120 | #pragma omp parallel sections reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 121 | { |
| 122 | foo(); |
| 123 | } |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 124 | #pragma omp parallel sections reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 125 | { |
| 126 | foo(); |
| 127 | } |
| 128 | #pragma omp parallel sections reduction(&& : argc) |
| 129 | { |
| 130 | foo(); |
| 131 | } |
| 132 | #pragma omp parallel sections reduction(^ : T) // expected-error {{'T' does not refer to a value}} |
| 133 | { |
| 134 | foo(); |
| 135 | } |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 136 | #pragma omp parallel sections reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 3 {{const-qualified list item cannot be reduction}} expected-error 2 {{'operator+' is a private member of 'S2'}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 137 | { |
| 138 | foo(); |
| 139 | } |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 140 | #pragma omp parallel sections reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 4 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 141 | { |
| 142 | foo(); |
| 143 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 144 | #pragma omp parallel sections reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 145 | { |
| 146 | foo(); |
| 147 | } |
Alexey Bataev | 1189bd0 | 2016-01-26 12:20:39 +0000 | [diff] [blame] | 148 | #pragma omp parallel sections reduction(+ : ba) // expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 149 | { |
| 150 | foo(); |
| 151 | } |
Alexey Bataev | 1189bd0 | 2016-01-26 12:20:39 +0000 | [diff] [blame] | 152 | #pragma omp parallel sections reduction(* : ca) // expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 153 | { |
| 154 | foo(); |
| 155 | } |
Alexey Bataev | 1189bd0 | 2016-01-26 12:20:39 +0000 | [diff] [blame] | 156 | #pragma omp parallel sections reduction(- : da) // expected-error {{const-qualified list item cannot be reduction}} expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 157 | { |
| 158 | foo(); |
| 159 | } |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 160 | #pragma omp parallel sections reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 161 | { |
| 162 | foo(); |
| 163 | } |
Alexey Bataev | dffa93a | 2015-12-10 08:20:58 +0000 | [diff] [blame] | 164 | #pragma omp parallel sections reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 165 | { |
| 166 | foo(); |
| 167 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 168 | #pragma omp parallel sections reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 169 | { |
| 170 | foo(); |
| 171 | } |
| 172 | #pragma omp parallel sections reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} |
| 173 | { |
| 174 | foo(); |
| 175 | } |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 176 | #pragma omp parallel sections reduction(+ : o) // expected-error 2 {{no viable overloaded '='}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 177 | { |
| 178 | foo(); |
| 179 | } |
| 180 | #pragma omp parallel sections private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} |
| 181 | { |
| 182 | foo(); |
| 183 | } |
| 184 | #pragma omp parallel private(k) |
| 185 | #pragma omp parallel sections reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} |
| 186 | { |
| 187 | foo(); |
| 188 | } |
Alexey Bataev | a839ddd | 2016-03-17 10:19:46 +0000 | [diff] [blame^] | 189 | #pragma omp parallel sections reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 190 | { |
| 191 | foo(); |
| 192 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 193 | #pragma omp parallel sections reduction(+ : r) // expected-error 2 {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 194 | { |
| 195 | foo(); |
| 196 | } |
| 197 | #pragma omp parallel shared(i) |
| 198 | #pragma omp parallel reduction(min : i) |
| 199 | #pragma omp parallel sections reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} |
| 200 | { |
| 201 | foo(); |
| 202 | } |
| 203 | #pragma omp parallel private(fl) |
| 204 | #pragma omp parallel sections reduction(+ : fl) |
| 205 | { |
| 206 | foo(); |
| 207 | } |
| 208 | #pragma omp parallel reduction(* : fl) |
| 209 | #pragma omp parallel sections reduction(+ : fl) |
| 210 | { |
| 211 | foo(); |
| 212 | } |
| 213 | |
| 214 | return T(); |
| 215 | } |
| 216 | |
Alexey Bataev | 6ddfe1a | 2015-04-16 13:49:42 +0000 | [diff] [blame] | 217 | namespace A { |
| 218 | double x; |
| 219 | #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} |
| 220 | } |
| 221 | namespace B { |
| 222 | using A::x; |
| 223 | } |
| 224 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 225 | int main(int argc, char **argv) { |
| 226 | const int d = 5; // expected-note 2 {{'d' defined here}} |
| 227 | const int da[5] = {0}; // expected-note {{'da' defined here}} |
| 228 | int qa[5] = {0}; |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 229 | S4 e(4); |
| 230 | S5 g(5); |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 231 | int i; |
| 232 | int &j = i; // expected-note 2 {{'j' defined here}} |
| 233 | S3 &p = k; // expected-note 2 {{'p' defined here}} |
| 234 | const int &r = da[i]; // expected-note {{'r' defined here}} |
| 235 | int &q = qa[i]; // expected-note {{'q' defined here}} |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 236 | float fl; |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 237 | #pragma omp parallel sections reduction // expected-error {{expected '(' after 'reduction'}} |
| 238 | { |
| 239 | foo(); |
| 240 | } |
| 241 | #pragma omp parallel sections reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 242 | { |
| 243 | foo(); |
| 244 | } |
| 245 | #pragma omp parallel sections reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 246 | { |
| 247 | foo(); |
| 248 | } |
| 249 | #pragma omp parallel sections reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 250 | { |
| 251 | foo(); |
| 252 | } |
| 253 | #pragma omp parallel sections reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} |
| 254 | { |
| 255 | foo(); |
| 256 | } |
| 257 | #pragma omp parallel sections reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} |
| 258 | { |
| 259 | foo(); |
| 260 | } |
| 261 | #pragma omp parallel sections reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} |
| 262 | { |
| 263 | foo(); |
| 264 | } |
| 265 | #pragma omp parallel sections reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}} |
| 266 | { |
| 267 | foo(); |
| 268 | } |
| 269 | #pragma omp parallel sections reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 270 | { |
| 271 | foo(); |
| 272 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 273 | #pragma omp parallel sections reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 274 | { |
| 275 | foo(); |
| 276 | } |
| 277 | #pragma omp parallel sections reduction(~ : argc) // expected-error {{expected unqualified-id}} |
| 278 | { |
| 279 | foo(); |
| 280 | } |
| 281 | #pragma omp parallel sections reduction(&& : argc) |
| 282 | { |
| 283 | foo(); |
| 284 | } |
| 285 | #pragma omp parallel sections reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} |
| 286 | { |
| 287 | foo(); |
| 288 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 289 | #pragma omp parallel sections reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified list item cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 290 | { |
| 291 | foo(); |
| 292 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 293 | #pragma omp parallel sections reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 294 | { |
| 295 | foo(); |
| 296 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 297 | #pragma omp parallel sections reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 298 | { |
| 299 | foo(); |
| 300 | } |
Alexey Bataev | 1189bd0 | 2016-01-26 12:20:39 +0000 | [diff] [blame] | 301 | #pragma omp parallel sections reduction(+ : ba) // expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 302 | { |
| 303 | foo(); |
| 304 | } |
Alexey Bataev | 1189bd0 | 2016-01-26 12:20:39 +0000 | [diff] [blame] | 305 | #pragma omp parallel sections reduction(* : ca) // expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 306 | { |
| 307 | foo(); |
| 308 | } |
Alexey Bataev | 1189bd0 | 2016-01-26 12:20:39 +0000 | [diff] [blame] | 309 | #pragma omp parallel sections reduction(- : da) // expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 310 | { |
| 311 | foo(); |
| 312 | } |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 313 | #pragma omp parallel sections reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 314 | { |
| 315 | foo(); |
| 316 | } |
Alexey Bataev | dffa93a | 2015-12-10 08:20:58 +0000 | [diff] [blame] | 317 | #pragma omp parallel sections reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 318 | { |
| 319 | foo(); |
| 320 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 321 | #pragma omp parallel sections reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 322 | { |
| 323 | foo(); |
| 324 | } |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 325 | #pragma omp parallel sections reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 326 | { |
| 327 | foo(); |
| 328 | } |
Alexey Bataev | 6ddfe1a | 2015-04-16 13:49:42 +0000 | [diff] [blame] | 329 | #pragma omp parallel sections reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 330 | { |
| 331 | foo(); |
| 332 | } |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 333 | #pragma omp parallel sections reduction(+ : o) // expected-error {{no viable overloaded '='}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 334 | { |
| 335 | foo(); |
| 336 | } |
| 337 | #pragma omp parallel sections private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} |
| 338 | { |
| 339 | foo(); |
| 340 | } |
| 341 | #pragma omp parallel private(k) |
| 342 | #pragma omp parallel sections reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} |
| 343 | { |
| 344 | foo(); |
| 345 | } |
| 346 | #pragma omp parallel sections reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}} |
| 347 | { |
| 348 | foo(); |
| 349 | } |
Alexey Bataev | a176421 | 2015-09-30 09:22:36 +0000 | [diff] [blame] | 350 | #pragma omp parallel sections reduction(+ : r) // expected-error {{const-qualified list item cannot be reduction}} |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 351 | { |
| 352 | foo(); |
| 353 | } |
| 354 | #pragma omp parallel shared(i) |
| 355 | #pragma omp parallel reduction(min : i) |
| 356 | #pragma omp parallel sections reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} |
| 357 | { |
| 358 | foo(); |
| 359 | } |
| 360 | #pragma omp parallel private(fl) |
| 361 | #pragma omp parallel sections reduction(+ : fl) |
| 362 | { |
| 363 | foo(); |
| 364 | } |
| 365 | #pragma omp parallel reduction(* : fl) |
| 366 | #pragma omp parallel sections reduction(+ : fl) |
| 367 | { |
| 368 | foo(); |
| 369 | } |
Kelvin Li | 4eea8c6 | 2015-09-15 18:56:58 +0000 | [diff] [blame] | 370 | static int m; |
| 371 | #pragma omp parallel sections reduction(+ : m) // OK |
| 372 | { |
| 373 | foo(); |
| 374 | } |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 375 | |
| 376 | return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<float>' requested here}} |
| 377 | } |