[LV] Add test showing debug output for loops with uncountable BTCs.
[llvm-project.git] / clang / test / SemaOpenCL / invalid-pipes-cl2.0.cl
blobedfce02f2ea259794960542c126d7d5c5139951b
1 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-strict-prototypes -cl-std=CL2.0
2 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-strict-prototypes -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables
3 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-strict-prototypes -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,-__opencl_c_program_scope_global_variables,-__opencl_c_device_enqueue
4 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++1.0
5 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables
6 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,-__opencl_c_program_scope_global_variables,-__opencl_c_device_enqueue
8 global pipe int gp; // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}}
9 global reserve_id_t rid; // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}}
11 extern pipe write_only int get_pipe(void); // expected-error {{'write_only' attribute only applies to parameters and typedefs}}
12 #if (__OPENCL_CPP_VERSION__ == 100) || (__OPENCL_C_VERSION__ == 200) || ((__OPENCL_CPP_VERSION__ == 202100 || __OPENCL_C_VERSION__ == 300) && defined(__opencl_c_program_scope_global_variables))
13 // expected-error-re@-2{{type '__global write_only pipe int ({{(void)?}})' can only be used as a function parameter in OpenCL}}
14 #else
15 // FIXME: '__private' here makes no sense since program scope variables feature is not supported, should diagnose as '__global' probably
16 // expected-error-re@-5{{type '__private write_only pipe int ({{(void)?}})' can only be used as a function parameter in OpenCL}}
17 #endif
19 kernel void test_invalid_reserved_id(reserve_id_t ID) { // expected-error {{'__private reserve_id_t' cannot be used as the type of a kernel parameter}}
22 void test1(pipe int *p) {// expected-error {{pipes packet types cannot be of reference type}}
24 void test2(pipe p) {// expected-error {{missing actual type specifier for pipe}}
26 void test3(int pipe p) {// expected-error {{cannot combine with previous 'int' declaration specifier}}
28 void test4(void) {
29 pipe int p; // expected-error {{type '__private read_only pipe int' can only be used as a function parameter}}
30 //TODO: fix parsing of this pipe int (*p);
33 void test5(pipe int p) {
34 p+p; // expected-error{{invalid operands to binary expression ('__private read_only pipe int' and '__private read_only pipe int')}}
35 p=p; // expected-error{{invalid operands to binary expression ('__private read_only pipe int' and '__private read_only pipe int')}}
36 &p; // expected-error{{invalid argument type '__private read_only pipe int' to unary expression}}
37 *p; // expected-error{{invalid argument type '__private read_only pipe int' to unary expression}}
40 typedef pipe int pipe_int_t;
41 pipe_int_t test6(void) {} // expected-error{{declaring function return value of type 'pipe_int_t' (aka 'read_only pipe int') is not allowed}}
43 bool test_id_comprision(void) {
44 reserve_id_t id1, id2;
45 return (id1 == id2); // expected-error {{invalid operands to binary expression ('__private reserve_id_t' and '__private reserve_id_t')}}
48 // Tests ASTContext::mergeTypes rejects this.
49 #ifndef __OPENCL_CPP_VERSION__
50 int f(pipe int x, int y); // expected-note {{previous declaration is here}}
51 int f(x, y) // expected-error {{conflicting types for 'f}}
52 pipe short x;
53 int y;
55 return y;
57 #endif