llvm-project
89 строк · 2.6 Кб
1// RUN: %clang_cc1 %s -verify -fopenacc
2
3void Func(int i, int j) {
4int array[5];
5#pragma acc parallel private(array[:])
6while (true);
7#pragma acc parallel private(array[i:])
8while (true);
9#pragma acc parallel private(array[:j])
10while (true);
11#pragma acc parallel private(array[i:j])
12while (true);
13#pragma acc parallel private(array[1:2])
14while (true);
15
16// expected-error@+1{{expected unqualified-id}}
17#pragma acc parallel private(array[::])
18while (true);
19// expected-error@+2{{expected ']'}}
20// expected-note@+1{{to match this '['}}
21#pragma acc parallel private(array[1::])
22while (true);
23// expected-error@+2{{expected ']'}}
24// expected-note@+1{{to match this '['}}
25#pragma acc parallel private(array[:2:])
26while (true);
27// expected-error@+3{{expected unqualified-id}}
28// expected-error@+2{{expected ']'}}
29// expected-note@+1{{to match this '['}}
30#pragma acc parallel private(array[::3])
31while (true);
32// expected-error@+2{{expected ']'}}
33// expected-note@+1{{to match this '['}}
34#pragma acc parallel private(array[1:2:3])
35while (true);
36}
37
38template<typename T, unsigned I, auto &IPtr>// #IPTR
39void TemplFunc() {
40T array[I];
41T array2[2*I];
42T t; // #tDecl
43#pragma acc parallel private(array[:])
44while (true);
45#pragma acc parallel private(array[t:])
46while (true);
47#pragma acc parallel private(array[I-1:])
48while (true);
49#pragma acc parallel private(array[IPtr:])
50while (true);
51#pragma acc parallel private(array[:t])
52while (true);
53#pragma acc parallel private(array[:I])
54while (true);
55#pragma acc parallel private(array[:IPtr])
56while (true);
57#pragma acc parallel private(array[t:t])
58while (true);
59#pragma acc parallel private(array2[I:I])
60while (true);
61#pragma acc parallel private(array[IPtr:IPtr])
62while (true);
63
64// expected-error@+1{{expected unqualified-id}}
65#pragma acc parallel private(array[::])
66while (true);
67// expected-error@+3{{'t' is not a class, namespace, or enumeration}}
68// expected-note@#tDecl{{'t' declared here}}
69// expected-error@+1{{expected unqualified-id}}
70#pragma acc parallel private(array[t::])
71while (true);
72// expected-error@+2{{expected ']'}}
73// expected-note@+1{{to match this '['}}
74#pragma acc parallel private(array[:I:])
75while (true);
76// expected-error@+2{{no member named 'IPtr' in the global namespace}}
77// expected-note@#IPTR{{'IPtr' declared here}}
78#pragma acc parallel private(array[::IPtr])
79while (true);
80// expected-error@+2{{expected ']'}}
81// expected-note@+1{{to match this '['}}
82#pragma acc parallel private(array[IPtr:I:t])
83while (true);
84}
85
86void use() {
87static constexpr int SomeI = 1;
88TemplFunc<int, 5, SomeI>();
89}
90