1 // RUN: %clang_cc1 -verify=omp50,expected,cxx17 -fopenmp -fopenmp-version=50 -ferror-limit 100 %std_cxx17- %s
2 // RUN: %clang_cc1 -verify=omp50,expected,precxx17 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 %std_cxx98-14 %s
4 // RUN: %clang_cc1 -verify=omp51,expected,cxx17 -fopenmp -ferror-limit 100 %std_cxx17- %s
5 // RUN: %clang_cc1 -verify=omp51,expected,precxx17 -fopenmp-simd -ferror-limit 100 %std_cxx98-14 %s
7 int temp
; // expected-note {{'temp' declared here}}
11 int p
; // expected-note {{declared private here}}
14 #pragma omp declare mapper(id: vec v) map(v.len)
18 #pragma omp declare mapper // expected-error {{expected '(' after 'declare mapper'}}
19 #pragma omp declare mapper { // expected-error {{expected '(' after 'declare mapper'}}
20 #pragma omp declare mapper( // expected-error {{expected a type}} expected-error {{expected declarator on 'omp declare mapper' directive}}
21 #pragma omp declare mapper(# // expected-error {{expected a type}} expected-error {{expected declarator on 'omp declare mapper' directive}}
22 #pragma omp declare mapper(v // expected-error {{unknown type name 'v'}} expected-error {{expected declarator on 'omp declare mapper' directive}}
23 #pragma omp declare mapper(vec // expected-error {{expected declarator on 'omp declare mapper' directive}}
24 #pragma omp declare mapper(S v // expected-error {{unknown type name 'S'}}
25 #pragma omp declare mapper(vec v // expected-error {{expected ')'}} expected-note {{to match this '('}}
26 #pragma omp declare mapper(aa: vec v) // expected-error {{expected at least one clause on '#pragma omp declare mapper' directive}}
27 #pragma omp declare mapper(bb: vec v) private(v) // expected-error {{expected at least one clause on '#pragma omp declare mapper' directive}} // expected-error {{unexpected OpenMP clause 'private' in directive '#pragma omp declare mapper'}}
28 #pragma omp declare mapper(cc: vec v) map(v) ( // expected-warning {{extra tokens at the end of '#pragma omp declare mapper' are ignored}}
30 #pragma omp declare mapper(++: vec v) map(v.len) // expected-error {{illegal OpenMP user-defined mapper identifier}}
31 #pragma omp declare mapper(id1: vec v) map(v.len, temp) // expected-error {{only variable 'v' is allowed in map clauses of this 'omp declare mapper' directive}}
32 #pragma omp declare mapper(default : vec kk) map(kk.data[0:2]) // expected-note {{previous definition is here}}
33 #pragma omp declare mapper(vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'default'}}
34 #pragma omp declare mapper(int v) map(v) // expected-error {{mapper type must be of struct, union or class type}}
35 #pragma omp declare mapper(id2: vec v) map(v.len, v.p) // expected-error {{'p' is a private member of 'vec'}}
39 class stack
{ // expected-note {{template is declared here}}
43 #pragma omp declare mapper(id: vec v) map(v.len) // expected-note {{previous definition is here}}
44 #pragma omp declare mapper(id: vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'id'}}
48 #pragma omp declare mapper(default : N1::stack s) map(s.len) // precxx17-error {{use of class template 'N1::stack' requires template arguments}} \
49 cxx17
-error
{{use of
class template 'stack' requires
template arguments
; argument deduction
not allowed in function prototype
}}
50 #pragma omp declare mapper(id1: N1::stack<int> s) map(s.data)
51 #pragma omp declare mapper(default : S<int> s) map(s.len) // expected-error {{no template named 'S'}}
55 #pragma omp declare mapper(id: vec v) map(v.len) // expected-note {{previous definition is here}}
56 #pragma omp declare mapper(id: vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'id'}}
60 #pragma omp declare mapper(id: vec v) map(v.len)
62 #pragma omp declare mapper(id: vec v) map(v.len) // expected-note {{previous definition is here}}
64 #pragma omp declare mapper(id: vec v) map(v.len)
67 #pragma omp target map(mapper) // expected-error {{use of undeclared identifier 'mapper'}}
69 #pragma omp target map(mapper:vv) // expected-error {{expected '(' after 'mapper'}}
71 #pragma omp target map(mapper( :vv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
73 #pragma omp target map(mapper(aa :vv) // expected-error {{use of undeclared identifier 'aa'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
75 #pragma omp target map(mapper(ab) :vv) // expected-error {{missing map type}} expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'ab'}}
77 #pragma omp target map(mapper(N2::) :vv) // expected-error {{use of undeclared identifier 'N2'}} expected-error {{illegal OpenMP user-defined mapper identifier}}
79 #pragma omp target map(mapper(N1::) :vv) // expected-error {{illegal OpenMP user-defined mapper identifier}}
81 #pragma omp target map(mapper(aa) :vv) // expected-error {{missing map type}}
83 #pragma omp target map(mapper(N1::aa) alloc:vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'aa'}}
85 #pragma omp target map(mapper(N1::aa) alloc:arr[0:2]) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'aa'}}
87 #pragma omp target map(mapper(aa) to:vv) map(close mapper(aa) from:v1) map(mapper(aa) to:arr[0])
89 #pragma omp target map(mapper(N1::stack<int>::id) to:vv)
92 #pragma omp target update to(mapper) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
93 #pragma omp target update to(mapper() // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
94 #pragma omp target update to(mapper:vv) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
95 #pragma omp target update to(mapper(:vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
96 #pragma omp target update to(mapper(aa :vv) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
97 #pragma omp target update to(mapper(N2:: :vv) // expected-error {{use of undeclared identifier 'N2'}} expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
98 #pragma omp target update to(mapper(N1:: :vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
99 #pragma omp target update to(mapper(N1::aa) :vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'aa'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
100 #pragma omp target update to(mapper(ab):vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'ab'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
101 #pragma omp target update to(mapper(ab):arr[0:2]) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'ab'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
102 #pragma omp target update to(mapper(aa) a:vv) // omp51-warning {{missing ':' after motion modifier - ignoring}} omp50-warning {{missing ':' after ) - ignoring}}
103 #pragma omp target update to(mapper(aa):vv) to(mapper(aa):arr[0])
104 #pragma omp target update to(mapper(N1::stack<int>::id) :vv)
106 #pragma omp target update from(mapper) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
107 #pragma omp target update from(mapper() // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
108 #pragma omp target update from(mapper:vv) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
109 #pragma omp target update from(mapper(:vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
110 #pragma omp target update from(mapper(aa :vv) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
111 #pragma omp target update from(mapper(N2:: :vv) // expected-error {{use of undeclared identifier 'N2'}} expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
112 #pragma omp target update from(mapper(N1:: :vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
113 #pragma omp target update from(mapper(N1::aa) :vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'aa'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
114 #pragma omp target update from(mapper(ab):vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'ab'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
115 #pragma omp target update from(mapper(ab):arr[0:2]) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'ab'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
116 #pragma omp target update from(mapper(aa) a:vv) // omp51-warning {{missing ':' after motion modifier - ignoring}} omp50-warning {{missing ':' after ) - ignoring}}
117 #pragma omp target update from(mapper(aa):vv) from(mapper(aa):arr[0])
118 #pragma omp target update from(mapper(N1::stack<int>::id) :vv)
120 #pragma omp declare mapper(id: vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'id'}}