1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 -o - %s 2 3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s 4 5 void foo() { 6 } 7 8 #pragma omp parallel // expected-error {{unexpected OpenMP directive '#pragma omp parallel'}} 9 10 int a; 11 struct S; 12 S& bar(); 13 int main(int argc, char **argv) { 14 S &s = bar(); 15 #pragma omp parallel 16 (void)&s; 17 #pragma omp parallel { // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 18 foo(); 19 #pragma omp parallel ( // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 20 foo(); 21 #pragma omp parallel [ // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 22 foo(); 23 #pragma omp parallel ] // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 24 foo(); 25 #pragma omp parallel ) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 26 foo(); 27 #pragma omp parallel } // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 28 foo(); 29 #pragma omp parallel 30 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel' are ignored}} 31 #pragma omp parallel unknown() 32 foo(); 33 L1: 34 foo(); 35 #pragma omp parallel ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp parallel'}} 36 ; 37 #pragma omp parallel 38 ; 39 #pragma omp parallel 40 { 41 goto L1; // expected-error {{use of undeclared label 'L1'}} 42 argc++; 43 } 44 45 for (int i = 0; i < 10; ++i) { 46 switch(argc) { 47 case (0): 48 #pragma omp parallel 49 { 50 foo(); 51 break; // expected-error {{'break' statement not in loop or switch statement}} 52 continue; // expected-error {{'continue' statement not in loop statement}} 53 } 54 default: 55 break; 56 } 57 } 58 #pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}} 59 { 60 ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} 61 ++a; // expected-error {{variable 'a' must have explicitly specified data sharing attributes}} 62 } 63 64 goto L2; // expected-error {{use of undeclared label 'L2'}} 65 #pragma omp parallel 66 L2: 67 foo(); 68 #pragma omp parallel 69 { 70 return 1; // expected-error {{cannot return from OpenMP region}} 71 } 72 73 [[]] // expected-error {{an attribute list cannot appear here}} 74 #pragma omp parallel 75 for (int n = 0; n < 100; ++n) {} 76 77 return 0; 78 } 79 80 struct a { 81 static constexpr int b = 0; 82 }; 83 template <bool> struct c; 84 template <typename d, typename e> bool operator<(d, e); 85 struct f { 86 int cbegin; 87 }; 88 class g { 89 f blocks; 90 void j(); 91 }; 92 template <typename> struct is_error_code_enum : a {}; 93 struct h { 94 template <typename i, typename = c<is_error_code_enum<i>::b>> h(i); 95 }; 96 h operator<(h, h); 97 void g::j() { 98 #pragma omp parallel for default(none) 99 for (auto a = blocks.cbegin; a < blocks; ++a) // expected-error {{invalid operands to binary expression ('f' and 'int')}} 100 ; 101 } 102