1 // RUN
: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std
=CL2.0
2 // RUN
: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std
=clc
++
4 global pipe int gp
; // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}}
5 global reserve_id_t rid
; // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}}
7 extern pipe write_only int get_pipe
(); // expected-error-re{{type '__global write_only pipe int ({{(void)?}})' can only be used as a function parameter in OpenCL}} expected-error{{'write_only' attribute only applies to parameters and typedefs}}
9 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
}}
12 void test1
(pipe int
*p
) {// expected-error
{{pipes packet types cannot be of reference type
}}
14 void test2
(pipe p
) {// expected-error
{{missing actual type specifier for pipe
}}
16 void test3
(int pipe p
) {// expected-error
{{cannot combine with previous
'int
' declaration specifier
}}
19 pipe int p
; // expected-error {{type '__private read_only pipe int' can only be used as a function parameter}}
20 //TODO
: fix parsing of this pipe int
(*p
);
23 void test5
(pipe int p
) {
24 p
+p
; // expected-error{{invalid operands to binary expression ('__private read_only pipe int' and '__private read_only pipe int')}}
25 p
=p
; // expected-error{{invalid operands to binary expression ('__private read_only pipe int' and '__private read_only pipe int')}}
26 &p
; // expected-error{{invalid argument type '__private read_only pipe int' to unary expression}}
27 *p
; // expected-error{{invalid argument type '__private read_only pipe int' to unary expression}}
30 typedef pipe int pipe_int_t
;
31 pipe_int_t test6
() {} // expected-error
{{declaring function return value of type
'pipe_int_t
' (aka 'read_only pipe int
') is not allowed
}}
33 bool test_id_comprision
(void) {
34 reserve_id_t id1
, id2
;
35 return
(id1 == id2
); // expected-error {{invalid operands to binary expression ('__private reserve_id_t' and '__private reserve_id_t')}}
38 // Tests ASTContext
::mergeTypes rejects this.
39 #ifndef __OPENCL_CPP_VERSION__
40 int f
(pipe int x
, int y
); // expected-note {{previous declaration is here}}
41 int f
(x, y
) // expected-error
{{conflicting types for
'f
}}