1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized 2 3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized 4 5 void foo() { 6 } 7 8 bool foobool(int argc) { 9 return argc; 10 } 11 12 struct S1; // expected-note 2 {{declared here}} 13 class S2 { 14 mutable int a; 15 16 public: 17 S2() : a(0) {} 18 S2 &operator=(S2 &s2) { return *this; } 19 }; 20 class S3 { 21 int a; 22 23 public: 24 S3() : a(0) {} 25 S3 &operator=(S3 &s3) { return *this; } 26 }; 27 class S4 { 28 int a; 29 S4(); 30 S4 &operator=(const S4 &s4); // expected-note 3 {{implicitly declared private here}} 31 32 public: 33 S4(int v) : a(v) {} 34 }; 35 class S5 { 36 int a; 37 S5() : a(0) {} 38 S5 &operator=(const S5 &s5) { return *this; } // expected-note 3 {{implicitly declared private here}} 39 40 public: 41 S5(int v) : a(v) {} 42 }; 43 template <class T> 44 class ST { 45 public: 46 static T s; 47 }; 48 49 S2 k; 50 S3 h; 51 S4 l(3); 52 S5 m(4); 53 #pragma omp threadprivate(h, k, l, m) 54 55 namespace A { 56 double x; 57 #pragma omp threadprivate(x) 58 } 59 namespace B { 60 using A::x; 61 } 62 63 template <class T, typename S, int N> 64 T tmain(T argc, S **argv) { 65 T i; 66 #pragma omp target 67 #pragma omp teams 68 #pragma omp distribute parallel for simd copyin // expected-error {{expected '(' after 'copyin'}} 69 for (i = 0; i < argc; ++i) 70 foo(); 71 #pragma omp target 72 #pragma omp teams 73 #pragma omp distribute parallel for simd copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 74 for (i = 0; i < argc; ++i) 75 foo(); 76 #pragma omp target 77 #pragma omp teams 78 #pragma omp distribute parallel for simd copyin() // expected-error {{expected expression}} 79 for (i = 0; i < argc; ++i) 80 foo(); 81 #pragma omp target 82 #pragma omp teams 83 #pragma omp distribute parallel for simd copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}} 84 for (i = 0; i < argc; ++i) 85 foo(); 86 #pragma omp target 87 #pragma omp teams 88 #pragma omp distribute parallel for simd copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 89 for (i = 0; i < argc; ++i) 90 foo(); 91 #pragma omp target 92 #pragma omp teams 93 #pragma omp distribute parallel for simd copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} 94 for (i = 0; i < argc; ++i) 95 foo(); 96 #pragma omp target 97 #pragma omp teams 98 #pragma omp distribute parallel for simd copyin(l) // expected-error 2 {{'operator=' is a private member of 'S4'}} 99 for (i = 0; i < argc; ++i) 100 foo(); 101 #pragma omp target 102 #pragma omp teams 103 #pragma omp distribute parallel for simd copyin(S1) // expected-error {{'S1' does not refer to a value}} 104 for (i = 0; i < argc; ++i) 105 foo(); 106 #pragma omp target 107 #pragma omp teams 108 #pragma omp distribute parallel for simd copyin(argv[1]) // expected-error {{expected variable name}} 109 for (i = 0; i < argc; ++i) 110 foo(); 111 #pragma omp target 112 #pragma omp teams 113 #pragma omp distribute parallel for simd copyin(i) // expected-error {{copyin variable must be threadprivate}} 114 for (i = 0; i < argc; ++i) 115 foo(); 116 #pragma omp target 117 #pragma omp teams 118 #pragma omp distribute parallel for simd copyin(m) // expected-error 2 {{'operator=' is a private member of 'S5'}} 119 for (i = 0; i < argc; ++i) 120 foo(); 121 #pragma omp target 122 #pragma omp teams 123 #pragma omp distribute parallel for simd copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}} 124 for (i = 0; i < argc; ++i) 125 foo(); 126 } 127 128 int main(int argc, char **argv) { 129 int i, z; 130 #pragma omp target 131 #pragma omp teams 132 #pragma omp distribute parallel for simd copyin // expected-error {{expected '(' after 'copyin'}} 133 for (i = 0; i < argc; ++i) 134 foo(); 135 #pragma omp target 136 #pragma omp teams 137 #pragma omp distribute parallel for simd copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 138 for (i = 0; i < argc; ++i) 139 foo(); 140 #pragma omp target 141 #pragma omp teams 142 #pragma omp distribute parallel for simd copyin() // expected-error {{expected expression}} 143 for (i = 0; i < argc; ++i) 144 foo(); 145 #pragma omp target 146 #pragma omp teams 147 #pragma omp distribute parallel for simd copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}} 148 for (i = 0; i < argc; ++i) 149 foo(); 150 #pragma omp target 151 #pragma omp teams 152 #pragma omp distribute parallel for simd copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 153 for (i = 0; i < argc; ++i) 154 foo(); 155 #pragma omp target 156 #pragma omp teams 157 #pragma omp distribute parallel for simd copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} 158 for (i = 0; i < argc; ++i) 159 foo(); 160 #pragma omp target 161 #pragma omp teams 162 #pragma omp distribute parallel for simd copyin(l) // expected-error {{'operator=' is a private member of 'S4'}} 163 for (i = 0; i < argc; ++i) 164 foo(); 165 #pragma omp target 166 #pragma omp teams 167 #pragma omp distribute parallel for simd copyin(S1) // expected-error {{'S1' does not refer to a value}} 168 for (i = 0; i < argc; ++i) 169 foo(); 170 #pragma omp target 171 #pragma omp teams 172 #pragma omp distribute parallel for simd copyin(argv[1]) // expected-error {{expected variable name}} 173 for (i = 0; i < argc; ++i) 174 foo(); 175 #pragma omp target 176 #pragma omp teams 177 #pragma omp distribute parallel for simd copyin(i) // expected-error {{copyin variable must be threadprivate}} 178 for (i = 0; i < argc; ++i) 179 foo(); 180 #pragma omp target 181 #pragma omp teams 182 #pragma omp distribute parallel for simd copyin(m) // expected-error {{'operator=' is a private member of 'S5'}} 183 for (i = 0; i < argc; ++i) 184 foo(); 185 #pragma omp target 186 #pragma omp teams 187 #pragma omp distribute parallel for simd copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}} 188 for (i = 0; i < argc; ++i) 189 foo(); 190 191 return tmain<int, char, 3>(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 3>' requested here}} 192 } 193