| 1 |
// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -fopenmp-version=60 -ferror-limit 100 -emit-llvm -o - %s |
| 2 |
// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -fopenmp-version=60 -ferror-limit 100 -emit-llvm -o - %s |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -fopenmp-version=60 -ferror-limit 100 -emit-llvm -o - %s |
| 5 |
// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -fopenmp-version=60 -ferror-limit 100 -emit-llvm -o - %s |
| 6 |
|
| 7 |
#pragma omp groupprivate // expected-error {{expected '(' after 'groupprivate'}} |
| 8 |
#pragma omp groupprivate( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 9 |
#pragma omp groupprivate() // expected-error {{expected identifier}} |
| 10 |
#pragma omp groupprivate(1) // expected-error {{expected unqualified-id}} |
| 11 |
struct CompleteSt{ |
| 12 |
int a; |
| 13 |
}; |
| 14 |
|
| 15 |
struct CompleteSt1{ |
| 16 |
#pragma omp groupprivate(1) // expected-error {{expected unqualified-id}} |
| 17 |
int a; |
| 18 |
} d; // expected-note {{'d' defined here}} |
| 19 |
|
| 20 |
int a; // expected-note {{'a' defined here}} |
| 21 |
|
| 22 |
#pragma omp groupprivate(a) allocate(a) // expected-warning {{extra tokens at the end of '#pragma omp groupprivate' are ignored}} |
| 23 |
#pragma omp groupprivate(u) // expected-error {{use of undeclared identifier 'u'}} |
| 24 |
int foo() { // expected-note {{declared here}} |
| 25 |
static int l; |
| 26 |
#pragma omp groupprivate(l)) // expected-warning {{extra tokens at the end of '#pragma omp groupprivate' are ignored}} |
| 27 |
return (a); |
| 28 |
} |
| 29 |
|
| 30 |
int x, y; |
| 31 |
#pragma omp groupprivate(x)) // expected-warning {{extra tokens at the end of '#pragma omp groupprivate' are ignored}} |
| 32 |
#pragma omp groupprivate(y)), |
| 33 |
// expected-warning@-1 {{extra tokens at the end of '#pragma omp groupprivate' are ignored}} |
| 34 |
#pragma omp groupprivate(d.a) // expected-error {{expected identifier}} |
| 35 |
#pragma omp groupprivate((float)a) // expected-error {{expected unqualified-id}} |
| 36 |
int foa; // expected-note {{'foa' declared here}} |
| 37 |
#pragma omp groupprivate(faa) // expected-error {{use of undeclared identifier 'faa'; did you mean 'foa'?}} |
| 38 |
#pragma omp groupprivate(foo) // expected-error {{'foo' is not a global variable, static local variable or static data member}} |
| 39 |
#pragma omp groupprivate (int a=2) // expected-error {{expected unqualified-id}} |
| 40 |
|
| 41 |
struct IncompleteSt; // expected-note {{forward declaration of 'IncompleteSt'}} |
| 42 |
|
| 43 |
extern IncompleteSt e; |
| 44 |
#pragma omp groupprivate (e) // expected-error {{groupprivate variable with incomplete type 'IncompleteSt'}} |
| 45 |
|
| 46 |
int &f = a; // expected-note {{'f' defined here}} |
| 47 |
#pragma omp groupprivate (f) // expected-error {{arguments of '#pragma omp groupprivate' cannot be of reference type 'int &'}} |
| 48 |
|
| 49 |
class TestClass { |
| 50 |
private: |
| 51 |
int a; // expected-note {{declared here}} |
| 52 |
static int b; // expected-note {{'b' declared here}} |
| 53 |
TestClass() : a(0){} |
| 54 |
public: |
| 55 |
TestClass (int aaa) : a(aaa) {} |
| 56 |
#pragma omp groupprivate (b, a) // expected-error {{'a' is not a global variable, static local variable or static data member}} |
| 57 |
} g(10); |
| 58 |
#pragma omp groupprivate (b) // expected-error {{use of undeclared identifier 'b'}} |
| 59 |
#pragma omp groupprivate (TestClass::b) // expected-error {{'#pragma omp groupprivate' must appear in the scope of the 'TestClass::b' variable declaration}} |
| 60 |
|
| 61 |
const int h = 12; // expected-note {{'h' defined here}} |
| 62 |
const volatile int i = 10; // expected-note {{'i' defined here}} |
| 63 |
// For groupprivate these have initializers -> groupprivate forbids variables with initializers. |
| 64 |
#pragma omp groupprivate (h, i) // expected-error {{variable 'h' with initializer cannot appear in groupprivate directive}} expected-error {{variable 'i' with initializer cannot appear in groupprivate directive}} |
| 65 |
|
| 66 |
template <class T> |
| 67 |
class TempClass { |
| 68 |
private: |
| 69 |
T a; |
| 70 |
TempClass() : a(){} |
| 71 |
public: |
| 72 |
TempClass (T aaa) : a(aaa) {} |
| 73 |
static T s; |
| 74 |
#pragma omp groupprivate (s) |
| 75 |
}; |
| 76 |
#pragma omp groupprivate (s) // expected-error {{use of undeclared identifier 's'}} |
| 77 |
|
| 78 |
int o; // expected-note {{candidate found by name lookup is 'o'}} |
| 79 |
#pragma omp groupprivate (o) |
| 80 |
namespace { |
| 81 |
int o; // expected-note {{candidate found by name lookup is '(anonymous namespace)::o'}} |
| 82 |
#pragma omp groupprivate (o) |
| 83 |
} |
| 84 |
#pragma omp groupprivate (o) // expected-error {{reference to 'o' is ambiguous}} |
| 85 |
|
| 86 |
int main(int argc, char **argv) { |
| 87 |
|
| 88 |
int x, y = argc; |
| 89 |
static double d1; |
| 90 |
static double d2; |
| 91 |
static double d3; // expected-note {{'d3' defined here}} |
| 92 |
static double d4; |
| 93 |
|
| 94 |
d.a = a; |
| 95 |
d2++; |
| 96 |
; |
| 97 |
#pragma omp groupprivate(argc+y) // expected-error {{expected identifier}} |
| 98 |
#pragma omp groupprivate(d2) // expected-error {{'#pragma omp groupprivate' must precede all references to variable 'd2'}} |
| 99 |
#pragma omp groupprivate(d1) |
| 100 |
{ |
| 101 |
++a;d2=0; |
| 102 |
#pragma omp groupprivate(d3) // expected-error {{'#pragma omp groupprivate' must appear in the scope of the 'd3' variable declaration}} |
| 103 |
} |
| 104 |
#pragma omp groupprivate(d3) |
| 105 |
label: |
| 106 |
#pragma omp groupprivate(d4) // expected-error {{'#pragma omp groupprivate' cannot be an immediate substatement}} |
| 107 |
|
| 108 |
#pragma omp groupprivate(a) // expected-error {{'#pragma omp groupprivate' must appear in the scope of the 'a' variable declaration}} |
| 109 |
return (y); |
| 110 |
#pragma omp groupprivate(d) // expected-error {{'#pragma omp groupprivate' must appear in the scope of the 'd' variable declaration}} |
| 111 |
} |