1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -x c++ -std=c++11 -fms-extensions %s
// expected-error@+1 {{expected an OpenMP directive}}
#pragma omp declare
// expected-error@+2 {{'#pragma omp declare simd' can only be applied to functions}}
#pragma omp declare simd
int a;
// expected-error@+2 {{'#pragma omp declare simd' can only be applied to functions}}
#pragma omp declare simd
#pragma omp threadprivate(a)
int var;
#pragma omp threadprivate(var)
// expected-error@+2 {{expected an OpenMP directive}} expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
#pragma omp declare simd
#pragma omp declare
// expected-error@+3 {{function declaration is expected after 'declare simd' directive}}
// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
#pragma omp declare simd
#pragma omp declare simd
#pragma options align=packed
int main();
// expected-error@+3 {{function declaration is expected after 'declare simd' directive}}
// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
#pragma omp declare simd
#pragma omp declare simd
#pragma init_seg(compiler)
int main();
// expected-error@+1 {{single declaration is expected after 'declare simd' directive}}
#pragma omp declare simd
// expected-note@+1 {{declared here}}
int b, c;
// expected-error@+1 {{'C' does not refer to a value}}
#pragma omp declare simd simdlen(C)
// expected-note@+1 {{declared here}}
template <class C>
void h(C *hp, C *hp2, C *hq, C *lin) {
b = 0;
}
#pragma omp declare simd
template <>
void h(int *hp, int *hp2, int *hq, int *lin) {
h((float *)hp, (float *)hp2, (float *)hq, (float *)lin);
}
#pragma omp declare simd inbranch inbranch
#pragma omp declare simd notinbranch notinbranch
#pragma omp declare simd inbranch inbranch notinbranch // expected-error {{unexpected 'notinbranch' clause, 'inbranch' is specified already}}
#pragma omp declare simd notinbranch notinbranch inbranch // expected-error {{unexpected 'inbranch' clause, 'notinbranch' is specified already}}
// expected-note@+2 {{read of non-const variable 'b' is not allowed in a constant expression}}
// expected-error@+1 {{expression is not an integral constant expression}}
#pragma omp declare simd simdlen(b)
// expected-error@+1 {{directive '#pragma omp declare simd' cannot contain more than one 'simdlen' clause}}
#pragma omp declare simd simdlen(32) simdlen(c)
// expected-error@+1 {{expected '(' after 'simdlen'}}
#pragma omp declare simd simdlen
// expected-note@+3 {{to match this '('}}
// expected-error@+2 {{expected ')'}}
// expected-error@+1 {{expected expression}}
#pragma omp declare simd simdlen(
// expected-error@+2 {{expected '(' after 'simdlen'}}
// expected-error@+1 {{expected expression}}
#pragma omp declare simd simdlen(), simdlen
// expected-error@+1 2 {{expected expression}}
#pragma omp declare simd simdlen(), simdlen()
// expected-warning@+3 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}
// expected-error@+2 {{expected '(' after 'simdlen'}}
// expected-error@+1 {{expected expression}}
#pragma omp declare simd simdlen() simdlen)
void foo();
// expected-error@+3 2 {{expected reference to one of the parameters of function 'foo'}}
// expected-error@+2 {{invalid use of 'this' outside of a non-static member function}}
// expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
#pragma omp declare simd simdlen(N) uniform(this, var)
template<int N>
void foo() {}
void test() {
// expected-note@+1 {{in instantiation of function template specialization 'foo<-3>' requested here}}
foo<-3>();
}
// expected-error@+1 {{expected '(' after 'uniform'}}
#pragma omp declare simd uniform
// expected-note@+3 {{to match this '('}}
// expected-error@+2 {{expected ')'}}
// expected-error@+1 {{expected expression}}
#pragma omp declare simd uniform(
// expected-error@+1 {{expected expression}}
#pragma omp declare simd uniform()
// expected-note@+3 {{to match this '('}}
// expected-error@+2 {{expected ')'}}
// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}
#pragma omp declare simd uniform(this
// expected-note@+3 {{to match this '('}}
// expected-error@+2 {{expected ')'}}
// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}
#pragma omp declare simd uniform(this,a
// expected-error@+1 {{expected expression}}
#pragma omp declare simd uniform(,a)
void bar(int a);
template <class T>
struct St {
// expected-error@+2 {{function declaration is expected after 'declare simd' directive}}
#pragma init_seg(compiler)
#pragma omp declare simd
#pragma init_seg(compiler)
// expected-error@+1 {{use of undeclared identifier 't'}}
#pragma omp declare simd uniform(this, t)
void h(T *hp) {
// expected-error@+1 {{unexpected OpenMP directive '#pragma omp declare simd'}}
#pragma omp declare simd
*hp = *t;
}
private:
T t;
};
namespace N {
// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
#pragma omp declare simd
}
// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
#pragma omp declare simd
// expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
#pragma omp declare simd
|