1*b8552abfSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized 2*b8552abfSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized 3*b8552abfSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized 4*b8552abfSAlexey Bataev 5*b8552abfSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized 6*b8552abfSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized 7*b8552abfSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized 8*b8552abfSAlexey Bataev 9*b8552abfSAlexey Bataev void foo() { 10*b8552abfSAlexey Bataev } 11*b8552abfSAlexey Bataev 12*b8552abfSAlexey Bataev #if __cplusplus >= 201103L 13*b8552abfSAlexey Bataev // expected-note@+2 4 {{declared here}} 14*b8552abfSAlexey Bataev #endif 15*b8552abfSAlexey Bataev bool foobool(int argc) { 16*b8552abfSAlexey Bataev return argc; 17*b8552abfSAlexey Bataev } 18*b8552abfSAlexey Bataev 19*b8552abfSAlexey Bataev struct S1; // expected-note {{declared here}} 20*b8552abfSAlexey Bataev 21*b8552abfSAlexey Bataev template <class T, typename S, int N, int ST> // expected-note {{declared here}} 22*b8552abfSAlexey Bataev T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} 23*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse // expected-error {{expected '(' after 'collapse'}} 24*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 25*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 26*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 27*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse () // expected-error {{expected expression}} 28*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 29*b8552abfSAlexey Bataev // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}} 30*b8552abfSAlexey Bataev // expected-error@+2 2 {{expression is not an integral constant expression}} 31*b8552abfSAlexey Bataev // expected-note@+1 2 {{read of non-const variable 'argc' is not allowed in a constant expression}} 32*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (argc 33*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 34*b8552abfSAlexey Bataev // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} 35*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (ST // expected-error {{expected ')'}} expected-note {{to match this '('}} 36*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 37*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (1)) // expected-warning {{extra tokens at the end of '#pragma omp master taskloop simd' are ignored}} 38*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 39*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} 40*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp master taskloop simd', but found only 1}} 41*b8552abfSAlexey Bataev // expected-error@+6 2 {{directive '#pragma omp master taskloop simd' cannot contain more than one 'collapse' clause}} 42*b8552abfSAlexey Bataev // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} 43*b8552abfSAlexey Bataev // expected-error@+4 2 {{expression is not an integral constant expression}} 44*b8552abfSAlexey Bataev #if __cplusplus >= 201103L 45*b8552abfSAlexey Bataev // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} 46*b8552abfSAlexey Bataev #endif 47*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (foobool(argc)), collapse (true), collapse (-5) 48*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 49*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (S) // expected-error {{'S' does not refer to a value}} 50*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 51*b8552abfSAlexey Bataev #if __cplusplus <= 199711L 52*b8552abfSAlexey Bataev // expected-error@+4 2 {{expression is not an integral constant expression}} 53*b8552abfSAlexey Bataev #else 54*b8552abfSAlexey Bataev // expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}} 55*b8552abfSAlexey Bataev #endif 56*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 57*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 58*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (1) 59*b8552abfSAlexey Bataev for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 60*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (N) // expected-error {{argument to 'collapse' clause must be a strictly positive integer value}} 61*b8552abfSAlexey Bataev for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 62*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (2) // expected-note {{as specified in 'collapse' clause}} 63*b8552abfSAlexey Bataev foo(); // expected-error {{expected 2 for loops after '#pragma omp master taskloop simd'}} 64*b8552abfSAlexey Bataev return argc; 65*b8552abfSAlexey Bataev } 66*b8552abfSAlexey Bataev 67*b8552abfSAlexey Bataev int main(int argc, char **argv) { 68*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse // expected-error {{expected '(' after 'collapse'}} 69*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 70*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 71*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 72*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse () // expected-error {{expected expression}} 73*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 74*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (4 // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{as specified in 'collapse' clause}} 75*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp master taskloop simd', but found only 1}} 76*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp master taskloop simd' are ignored}} expected-note {{as specified in 'collapse' clause}} 77*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp master taskloop simd', but found only 1}} 78*b8552abfSAlexey Bataev // expected-error@+4 {{expression is not an integral constant expression}} 79*b8552abfSAlexey Bataev #if __cplusplus >= 201103L 80*b8552abfSAlexey Bataev // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} 81*b8552abfSAlexey Bataev #endif 82*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (foobool(1) > 0 ? 1 : 2) 83*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 84*b8552abfSAlexey Bataev // expected-error@+6 {{expression is not an integral constant expression}} 85*b8552abfSAlexey Bataev #if __cplusplus >= 201103L 86*b8552abfSAlexey Bataev // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} 87*b8552abfSAlexey Bataev #endif 88*b8552abfSAlexey Bataev // expected-error@+2 2 {{directive '#pragma omp master taskloop simd' cannot contain more than one 'collapse' clause}} 89*b8552abfSAlexey Bataev // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} 90*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (foobool(argc)), collapse (true), collapse (-5) 91*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 92*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (S1) // expected-error {{'S1' does not refer to a value}} 93*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 94*b8552abfSAlexey Bataev #if __cplusplus <= 199711L 95*b8552abfSAlexey Bataev // expected-error@+4 {{expression is not an integral constant expression}} 96*b8552abfSAlexey Bataev #else 97*b8552abfSAlexey Bataev // expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}} 98*b8552abfSAlexey Bataev #endif 99*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 100*b8552abfSAlexey Bataev for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 101*b8552abfSAlexey Bataev // expected-error@+3 {{statement after '#pragma omp master taskloop simd' must be a for loop}} 102*b8552abfSAlexey Bataev // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}} 103*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse(collapse(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} 104*b8552abfSAlexey Bataev foo(); 105*b8552abfSAlexey Bataev #pragma omp master taskloop simd collapse (2) // expected-note {{as specified in 'collapse' clause}} 106*b8552abfSAlexey Bataev foo(); // expected-error {{expected 2 for loops after '#pragma omp master taskloop simd'}} 107*b8552abfSAlexey Bataev // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}} 108*b8552abfSAlexey Bataev return tmain<int, char, 1, 0>(argc, argv); 109*b8552abfSAlexey Bataev } 110*b8552abfSAlexey Bataev 111