Home | History | Annotate | Download | only in OpenMP
      1 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 %s
      2 
      3 void foo() {
      4 }
      5 
      6 bool foobool(int argc) {
      7   return argc;
      8 }
      9 
     10 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
     11 extern S1 a;
     12 class S2 {
     13   mutable int a;
     14 public:
     15   S2():a(0) { }
     16   static float S2s;
     17 };
     18 const S2 b;
     19 const S2 ba[5];
     20 class S3 {
     21   int a;
     22 public:
     23   S3():a(0) { }
     24 };
     25 const S3 c;
     26 const S3 ca[5];
     27 extern const int f;
     28 class S4 { // expected-note {{'S4' declared here}}
     29   int a;
     30   S4();
     31 public:
     32   S4(int v):a(v) { }
     33 };
     34 class S5 { // expected-note {{'S5' declared here}}
     35   int a;
     36   S5():a(0) {}
     37 public:
     38   S5(int v):a(v) { }
     39 };
     40 
     41 int main(int argc, char **argv) {
     42   const int d = 5;
     43   const int da[5] = { 0 };
     44   S4 e(4); // expected-note {{'e' defined here}}
     45   S5 g(5); // expected-note {{'g' defined here}}
     46   int i;
     47   int &j = i; // expected-note {{'j' defined here}}
     48   #pragma omp parallel private // expected-error {{expected '(' after 'private'}}
     49   #pragma omp parallel private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     50   #pragma omp parallel private () // expected-error {{expected expression}}
     51   #pragma omp parallel private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     52   #pragma omp parallel private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     53   #pragma omp parallel private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
     54   #pragma omp parallel private (argc argv) // expected-error {{expected ',' or ')' in 'private' clause}}
     55   #pragma omp parallel private (S1) // expected-error {{'S1' does not refer to a value}}
     56   #pragma omp parallel private (a, b, c, d, f) // expected-error {{a private variable with incomplete type 'S1'}}
     57   #pragma omp parallel private (argv[1]) // expected-error {{expected variable name}}
     58   #pragma omp parallel private(ba)
     59   #pragma omp parallel private(ca)
     60   #pragma omp parallel private(da)
     61   #pragma omp parallel private(S2::S2s)
     62   #pragma omp parallel private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}}
     63   foo();
     64   #pragma omp parallel private(i)
     65   #pragma omp parallel private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type 'int &'}}
     66   foo();
     67 
     68   return 0;
     69 }
     70