diff options
author | dim <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
commit | c86b984ea8ecb3e944dc3de48539f4c1f65851ea (patch) | |
tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /test/OpenMP/for_loop_messages.cpp | |
parent | c696171ff15f0ee60dea4abfd99a135473c95656 (diff) | |
download | FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.zip FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.tar.gz |
Vendor import of clang RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc1@226102
Diffstat (limited to 'test/OpenMP/for_loop_messages.cpp')
-rw-r--r-- | test/OpenMP/for_loop_messages.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/OpenMP/for_loop_messages.cpp b/test/OpenMP/for_loop_messages.cpp index 8cc882e..cb32484 100644 --- a/test/OpenMP/for_loop_messages.cpp +++ b/test/OpenMP/for_loop_messages.cpp @@ -11,6 +11,7 @@ public: static int sii; #pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}} +static int globalii; int test_iteration_spaces() { const int N = 100; @@ -311,6 +312,23 @@ int test_iteration_spaces() { } #pragma omp parallel + { +// expected-error@+2 {{loop iteration variable in the associated loop of 'omp for' directive may not be a variable with global storage without being explicitly marked as private}} +#pragma omp for + for (globalii = 0; globalii < 10; globalii += 1) + c[globalii] = a[globalii]; + } + +#pragma omp parallel + { +// expected-error@+3 {{loop iteration variable in the associated loop of 'omp for' directive may not be a variable with global storage without being explicitly marked as private}} +#pragma omp for collapse(2) + for (ii = 0; ii < 10; ii += 1) + for (globalii = 0; globalii < 10; globalii += 1) + c[globalii] += a[globalii] + ii; + } + +#pragma omp parallel // expected-error@+2 {{statement after '#pragma omp for' must be a for loop}} #pragma omp for for (auto &item : a) { @@ -360,6 +378,8 @@ public: Iter0 operator--() { return *this; } bool operator<(Iter0 a) { return true; } }; +// expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'Iter0' for 1st argument}} +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}} int operator-(Iter0 a, Iter0 b) { return 0; } class Iter1 { public: @@ -378,6 +398,7 @@ public: GoodIter &operator=(const GoodIter &that) { return *this; } GoodIter &operator=(const Iter0 &that) { return *this; } GoodIter &operator+=(int x) { return *this; } + GoodIter &operator-=(int x) { return *this; } explicit GoodIter(void *) {} GoodIter operator++() { return *this; } GoodIter operator--() { return *this; } @@ -388,11 +409,20 @@ public: typedef int difference_type; typedef std::random_access_iterator_tag iterator_category; }; +// expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'GoodIter' for 2nd argument}} +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}} int operator-(GoodIter a, GoodIter b) { return 0; } +// expected-note@+1 3 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}} GoodIter operator-(GoodIter a) { return a; } +// expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'int' for 2nd argument}} +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}} GoodIter operator-(GoodIter a, int v) { return GoodIter(); } +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'GoodIter' for 1st argument}} GoodIter operator+(GoodIter a, int v) { return GoodIter(); } +// expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'int' for 1st argument}} +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}} GoodIter operator-(int v, GoodIter a) { return GoodIter(); } +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'int' for 1st argument}} GoodIter operator+(int v, GoodIter a) { return GoodIter(); } int test_with_random_access_iterator() { @@ -435,6 +465,8 @@ int test_with_random_access_iterator() { #pragma omp for for (begin = GoodIter(0); begin < end; ++begin) ++begin; +// expected-error@+4 {{invalid operands to binary expression ('GoodIter' and 'const Iter0')}} +// expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}} #pragma omp parallel #pragma omp for for (begin = begin0; begin < end; ++begin) @@ -489,17 +521,22 @@ int test_with_random_access_iterator() { #pragma omp for for (GoodIter I = begin; I >= end; I = 2 - I) ++I; +// In the following example, we cannot update the loop variable using '+=' +// expected-error@+3 {{invalid operands to binary expression ('Iter0' and 'int')}} #pragma omp parallel #pragma omp for for (Iter0 I = begin0; I < end0; ++I) ++I; #pragma omp parallel // Initializer is constructor without params. +// expected-error@+3 {{invalid operands to binary expression ('Iter0' and 'int')}} // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} #pragma omp for for (Iter0 I; I < end0; ++I) ++I; Iter1 begin1, end1; +// expected-error@+4 {{invalid operands to binary expression ('Iter1' and 'Iter1')}} +// expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}} #pragma omp parallel #pragma omp for for (Iter1 I = begin1; I < end1; ++I) @@ -511,6 +548,8 @@ int test_with_random_access_iterator() { for (Iter1 I = begin1; I >= end1; ++I) ++I; #pragma omp parallel +// expected-error@+5 {{invalid operands to binary expression ('Iter1' and 'Iter1')}} +// expected-error@+4 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}} // Initializer is constructor with all default params. // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} #pragma omp for |