2015-05-20 12:24:19 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
|
2014-07-08 16:12:03 +08:00
|
|
|
|
2017-12-30 02:07:07 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s
|
|
|
|
|
2014-07-08 16:12:03 +08:00
|
|
|
void foo() {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool foobool(int argc) {
|
|
|
|
return argc;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S1; // expected-note {{declared here}}
|
|
|
|
class S2 {
|
|
|
|
mutable int a;
|
|
|
|
|
|
|
|
public:
|
|
|
|
S2() : a(0) {}
|
|
|
|
S2 &operator=(S2 &s2) { return *this; }
|
|
|
|
};
|
|
|
|
class S3 {
|
|
|
|
int a;
|
|
|
|
|
|
|
|
public:
|
|
|
|
S3() : a(0) {}
|
|
|
|
S3 &operator=(S3 &s3) { return *this; }
|
|
|
|
};
|
2015-04-16 13:39:01 +08:00
|
|
|
class S4 {
|
2014-07-08 16:12:03 +08:00
|
|
|
int a;
|
|
|
|
S4();
|
2015-04-16 13:39:01 +08:00
|
|
|
S4 &operator=(const S4 &s4); // expected-note {{implicitly declared private here}}
|
2014-07-08 16:12:03 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
S4(int v) : a(v) {}
|
|
|
|
};
|
2015-04-16 13:39:01 +08:00
|
|
|
class S5 {
|
2014-07-08 16:12:03 +08:00
|
|
|
int a;
|
|
|
|
S5() : a(0) {}
|
2015-04-16 13:39:01 +08:00
|
|
|
S5 &operator=(const S5 &s5) { return *this; } // expected-note {{implicitly declared private here}}
|
2014-07-08 16:12:03 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
S5(int v) : a(v) {}
|
|
|
|
};
|
|
|
|
template <class T>
|
|
|
|
class ST {
|
|
|
|
public:
|
|
|
|
static T s;
|
|
|
|
};
|
|
|
|
|
|
|
|
S2 k;
|
|
|
|
S3 h;
|
2015-04-16 13:39:01 +08:00
|
|
|
S4 l(3);
|
|
|
|
S5 m(4);
|
2014-07-08 16:12:03 +08:00
|
|
|
#pragma omp threadprivate(h, k, l, m)
|
|
|
|
|
2015-04-16 21:49:42 +08:00
|
|
|
namespace A {
|
|
|
|
double x;
|
|
|
|
#pragma omp threadprivate(x)
|
|
|
|
}
|
|
|
|
namespace B {
|
|
|
|
using A::x;
|
|
|
|
}
|
|
|
|
|
2014-07-08 16:12:03 +08:00
|
|
|
int main(int argc, char **argv) {
|
|
|
|
int i;
|
|
|
|
#pragma omp parallel sections copyin // expected-error {{expected '(' after 'copyin'}}
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
#pragma omp parallel sections copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
#pragma omp parallel sections copyin() // expected-error {{expected expression}}
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
#pragma omp parallel sections copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
2016-04-01 16:43:42 +08:00
|
|
|
#pragma omp parallel sections copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
2014-07-08 16:12:03 +08:00
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
#pragma omp parallel sections copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
2015-04-16 13:39:01 +08:00
|
|
|
#pragma omp parallel sections copyin(l) // expected-error {{'operator=' is a private member of 'S4'}}
|
2014-07-08 16:12:03 +08:00
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
#pragma omp parallel sections copyin(S1) // expected-error {{'S1' does not refer to a value}}
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
#pragma omp parallel sections copyin(argv[1]) // expected-error {{expected variable name}}
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
#pragma omp parallel sections copyin(i) // expected-error {{copyin variable must be threadprivate}}
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
2015-04-16 13:39:01 +08:00
|
|
|
#pragma omp parallel sections copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
|
2014-07-08 16:12:03 +08:00
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
2015-04-16 21:49:42 +08:00
|
|
|
#pragma omp parallel sections copyin(ST < int > ::s, B::x) // expected-error {{copyin variable must be threadprivate}}
|
2014-07-08 16:12:03 +08:00
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|