diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-30 09:22:36 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-30 09:22:36 +0000 |
commit | 64890837287cf66e92bccc0598ee9e092b3dc3d7 (patch) | |
tree | 105f17f399012c4ad0f6b59c4d84250b4c458c76 /test/OpenMP/teams_reduction_messages.cpp | |
parent | 5f95a2dabe094bc2b4cd91c342a1c0cf0a0ef148 (diff) |
[OPENMP 4.1] Sema analysis for array sections in 'reduction' clause.
OpenMP 4.1 allows to use array sections|subscript expressions in 'reduction' clauses. Added sema analysis, updated tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/OpenMP/teams_reduction_messages.cpp')
-rw-r--r-- | test/OpenMP/teams_reduction_messages.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/test/OpenMP/teams_reduction_messages.cpp b/test/OpenMP/teams_reduction_messages.cpp index 1a1e693576..260cb33201 100644 --- a/test/OpenMP/teams_reduction_messages.cpp +++ b/test/OpenMP/teams_reduction_messages.cpp @@ -26,6 +26,7 @@ class S3 { int a; public: + int b; S3() : a(0) {} S3(const S3 &s3) : a(s3.a) {} S3 operator+(const S3 &arg1) { return arg1; } @@ -103,7 +104,7 @@ T tmain(T argc) { #pragma omp teams reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}} foo(); #pragma omp target -#pragma omp teams reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name}} +#pragma omp teams reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}} foo(); #pragma omp target #pragma omp teams reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}} @@ -115,22 +116,22 @@ T tmain(T argc) { #pragma omp teams reduction(^ : T) // expected-error {{'T' does not refer to a value}} foo(); #pragma omp target -#pragma omp teams reduction(+ : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 3 {{const-qualified variable cannot be reduction}} expected-error 3 {{'operator+' is a private member of 'S2'}} +#pragma omp teams 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 3 {{'operator+' is a private member of 'S2'}} foo(); #pragma omp target -#pragma omp teams reduction(min : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified variable cannot be reduction}} +#pragma omp teams 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 3 {{const-qualified list item cannot be reduction}} foo(); #pragma omp target -#pragma omp teams reduction(max : qa[1]) // expected-error 2 {{expected variable name}} +#pragma omp teams reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} foo(); #pragma omp target -#pragma omp teams reduction(+ : ba) // expected-error {{a reduction variable with array type 'const S2 [5]'}} +#pragma omp teams reduction(+ : ba) // expected-error {{a reduction list item with array type 'const S2 [5]'}} foo(); #pragma omp target -#pragma omp teams reduction(* : ca) // expected-error {{a reduction variable with array type 'const S3 [5]'}} +#pragma omp teams reduction(* : ca) // expected-error {{a reduction list item with array type 'const S3 [5]'}} foo(); #pragma omp target -#pragma omp teams reduction(- : da) // expected-error {{a reduction variable with array type 'const int [5]'}} expected-error {{a reduction variable with array type 'const float [5]'}} +#pragma omp teams reduction(- : da) // expected-error {{a reduction list item with array type 'const int [5]'}} expected-error {{a reduction list item with array type 'const float [5]'}} foo(); #pragma omp target #pragma omp teams reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}} @@ -139,7 +140,7 @@ T tmain(T argc) { #pragma omp teams reduction(&& : S2::S2s) foo(); #pragma omp target -#pragma omp teams reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}} +#pragma omp teams reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}} foo(); #pragma omp target #pragma omp teams reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} @@ -158,7 +159,7 @@ T tmain(T argc) { #pragma omp teams reduction(+ : p), reduction(+ : p) // expected-error 3 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 3 {{previously referenced here}} foo(); #pragma omp target -#pragma omp teams reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}} +#pragma omp teams reduction(+ : r) // expected-error 2 {{const-qualified list item cannot be reduction}} foo(); #pragma omp parallel shared(i) #pragma omp parallel reduction(min : i) @@ -231,7 +232,7 @@ int main(int argc, char **argv) { #pragma omp teams reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} foo(); #pragma omp target -#pragma omp teams reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} +#pragma omp teams reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}} foo(); #pragma omp target #pragma omp teams reduction(~ : argc) // expected-error {{expected unqualified-id}} @@ -243,22 +244,22 @@ int main(int argc, char **argv) { #pragma omp teams reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} foo(); #pragma omp target -#pragma omp teams reduction(+ : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} +#pragma omp teams 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'}} foo(); #pragma omp target -#pragma omp teams reduction(min : a, b, c, d, f) // expected-error {{reduction variable 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 variable cannot be reduction}} +#pragma omp teams 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}} foo(); #pragma omp target -#pragma omp teams reduction(max : argv[1]) // expected-error {{expected variable name}} +#pragma omp teams reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} foo(); #pragma omp target -#pragma omp teams reduction(+ : ba) // expected-error {{a reduction variable with array type 'const S2 [5]'}} +#pragma omp teams reduction(+ : ba) // expected-error {{a reduction list item with array type 'const S2 [5]'}} foo(); #pragma omp target -#pragma omp teams reduction(* : ca) // expected-error {{a reduction variable with array type 'const S3 [5]'}} +#pragma omp teams reduction(* : ca) // expected-error {{a reduction list item with array type 'const S3 [5]'}} foo(); #pragma omp target -#pragma omp teams reduction(- : da) // expected-error {{a reduction variable with array type 'const int [5]'}} +#pragma omp teams reduction(- : da) // expected-error {{a reduction list item with array type 'const int [5]'}} foo(); #pragma omp target #pragma omp teams reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}} @@ -267,7 +268,7 @@ int main(int argc, char **argv) { #pragma omp teams reduction(&& : S2::S2s) foo(); #pragma omp target -#pragma omp teams reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}} +#pragma omp teams reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}} foo(); #pragma omp target #pragma omp teams 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')}} @@ -289,7 +290,7 @@ int main(int argc, char **argv) { #pragma omp teams reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}} foo(); #pragma omp target -#pragma omp teams reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}} +#pragma omp teams reduction(+ : r) // expected-error {{const-qualified list item cannot be reduction}} foo(); #pragma omp parallel shared(i) #pragma omp parallel reduction(min : i) |