Clang Project

clang_source_code/test/OpenMP/parallel_copyin_messages.cpp
1// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
2
3// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s
4
5void foo() {
6}
7
8bool foobool(int argc) {
9  return argc;
10}
11
12struct S1; // expected-note {{declared here}}
13class S2 {
14  mutable int a;
15public:
16  S2():a(0) { }
17  S2 & operator =(S2 &s2) { return *this; }
18};
19class S3 {
20  int a;
21public:
22  S3():a(0) { }
23  S3 &operator =(S3 &s3) { return *this; }
24};
25class S4 {
26  int a;
27  S4();
28  S4 &operator =(const S4 &s4); // expected-note {{implicitly declared private here}}
29public:
30  S4(int v):a(v) { }
31};
32class S5 {
33  int a;
34  S5():a(0) {}
35  S5 &operator =(const S5 &s5) { return *this; } // expected-note {{implicitly declared private here}}
36public:
37  S5(int v):a(v) { }
38};
39template <class T>
40class ST {
41public:
42  static T s;
43};
44
45namespace A {
46double x;
47#pragma omp threadprivate(x)
48}
49namespace B {
50using A::x;
51}
52
53S2 k;
54S3 h;
55S4 l(3);
56S5 m(4);
57#pragma omp threadprivate(h, k, l, m)
58
59int main(int argc, char **argv) {
60  int i;
61  #pragma omp parallel copyin // expected-error {{expected '(' after 'copyin'}}
62  #pragma omp parallel copyin ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
63  #pragma omp parallel copyin () // expected-error {{expected expression}}
64  #pragma omp parallel copyin (k // expected-error {{expected ')'}} expected-note {{to match this '('}}
65  #pragma omp parallel copyin (h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
66  #pragma omp parallel copyin (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
67  #pragma omp parallel copyin (l) // expected-error {{'operator=' is a private member of 'S4'}}
68  #pragma omp parallel copyin (S1) // expected-error {{'S1' does not refer to a value}}
69  #pragma omp parallel copyin (argv[1]) // expected-error {{expected variable name}}
70  #pragma omp parallel copyin(i) // expected-error {{copyin variable must be threadprivate}}
71  #pragma omp parallel copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
72  #pragma omp parallel copyin(ST<int>::s) // expected-error {{copyin variable must be threadprivate}}
73  #pragma omp parallel copyin(B::x)
74  foo();
75
76  return 0;
77}
78