| 1 |
// Test parsing of #pragma omp declare simd |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
#pragma omp declare simd |
| 5 |
int a; // { dg-error "not immediately followed by function declaration or definition" } |
| 6 |
|
| 7 |
#pragma omp declare simd |
| 8 |
int fn1 (int a), fn2 (int a); // { dg-error "not immediately followed by a single function declaration or definition" } |
| 9 |
|
| 10 |
#pragma omp declare simd |
| 11 |
int b, fn3 (int a); // { dg-error "not immediately followed by function declaration or definition" } |
| 12 |
|
| 13 |
#pragma omp declare simd linear (a) |
| 14 |
int fn4 (int a), c; // { dg-error "not immediately followed by function declaration or definition" } |
| 15 |
|
| 16 |
#pragma omp declare simd |
| 17 |
extern "C" // { dg-error "not immediately followed by function declaration or definition" } |
| 18 |
{ |
| 19 |
int fn5 (int a); |
| 20 |
} |
| 21 |
|
| 22 |
#pragma omp declare simd // { dg-error "not immediately followed by function declaration or definition" } |
| 23 |
namespace N1 |
| 24 |
{ |
| 25 |
int fn6 (int a); |
| 26 |
} |
| 27 |
|
| 28 |
#pragma omp declare simd simdlen (4) |
| 29 |
struct A |
| 30 |
{ // { dg-error "not immediately followed by function declaration or definition" } |
| 31 |
int fn7 (int a); |
| 32 |
}; |
| 33 |
|
| 34 |
#pragma omp declare simd |
| 35 |
template <typename T> |
| 36 |
struct B |
| 37 |
{ // { dg-error "not immediately followed by function declaration or definition" } |
| 38 |
int fn8 (int a); |
| 39 |
}; |
| 40 |
|
| 41 |
struct C |
| 42 |
{ |
| 43 |
#pragma omp declare simd // { dg-error "not immediately followed by function declaration or definition" } |
| 44 |
public: // { dg-error "expected unqualified-id before" } |
| 45 |
int fn9 (int a); |
| 46 |
}; |
| 47 |
|
| 48 |
int t; |
| 49 |
|
| 50 |
#pragma omp declare simd |
| 51 |
#pragma omp declare simd |
| 52 |
#pragma omp threadprivate(t) // { dg-error "not immediately followed by function declaration or definition" } |
| 53 |
int fn10 (int a); |
| 54 |
|
| 55 |
#pragma omp declare simd inbranch notinbranch // { dg-error "clause is incompatible with" } |
| 56 |
int fn11 (int); |
| 57 |
|
| 58 |
struct D |
| 59 |
{ |
| 60 |
int d; |
| 61 |
#pragma omp declare simd simdlen (N) linear (a : sizeof (e) + sizeof (this->e)) // { dg-error "was not declared" } |
| 62 |
template <int N> |
| 63 |
int fn12 (int a); |
| 64 |
int e; |
| 65 |
}; |
| 66 |
|
| 67 |
#pragma omp declare simd aligned (a, b, c, d) |
| 68 |
int fn13 (int *a, int b[64], int *&c, int (&d)[64]); |
| 69 |
|
| 70 |
#pragma omp declare simd aligned (a) // { dg-error "neither a pointer nor an array" } |
| 71 |
int fn14 (int a); |
| 72 |
|
| 73 |
#pragma omp declare simd aligned (b) // { dg-error "neither a pointer nor an array" } |
| 74 |
int fn14 (int &b); |
| 75 |
|
| 76 |
#pragma omp declare simd aligned (c) // { dg-error "neither a pointer nor an array" } |
| 77 |
int fn14 (float c); |
| 78 |
|
| 79 |
#pragma omp declare simd aligned (d) // { dg-error "neither a pointer nor an array" } |
| 80 |
int fn14 (double &d); |
| 81 |
|
| 82 |
#pragma omp declare simd aligned (e) // { dg-error "neither a pointer nor an array" } |
| 83 |
int fn14 (D e); |
| 84 |
|
| 85 |
#pragma omp declare simd linear(a:7) uniform(a) // { dg-error "appears more than once" } |
| 86 |
int f15 (int a); |
| 87 |
#pragma omp declare simd linear(a) linear(a) // { dg-error "appears more than once" } |
| 88 |
int f16 (int a); |
| 89 |
#pragma omp declare simd linear(a) linear(a:7) // { dg-error "appears more than once" } |
| 90 |
int f17 (int a); |
| 91 |
#pragma omp declare simd linear(a:6) linear(a:6)// { dg-error "appears more than once" } |
| 92 |
int f18 (int a); |
| 93 |
#pragma omp declare simd uniform(a) uniform(a) // { dg-error "appears more than once" } |
| 94 |
int f19 (int a); |
| 95 |
#pragma omp declare simd uniform(a) aligned (a: 32) |
| 96 |
int f20 (int *a); |
| 97 |
|
| 98 |
// { dg-error "has no member" "" { target *-*-* } 61 } |