1 | // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 |
2 | |
3 | global pipe int gp; // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}} |
4 | global reserve_id_t rid; // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}} |
5 | |
6 | extern pipe write_only int get_pipe(); // expected-error {{type '__global write_only pipe int (void)' can only be used as a function parameter in OpenCL}} |
7 | |
8 | kernel void test_invalid_reserved_id(reserve_id_t ID) { // expected-error {{'reserve_id_t' cannot be used as the type of a kernel parameter}} |
9 | } |
10 | |
11 | void test1(pipe int *p) {// expected-error {{pipes packet types cannot be of reference type}} |
12 | } |
13 | void test2(pipe p) {// expected-error {{missing actual type specifier for pipe}} |
14 | } |
15 | void test3(int pipe p) {// expected-error {{cannot combine with previous 'int' declaration specifier}} |
16 | } |
17 | void test4() { |
18 | pipe int p; // expected-error {{type 'read_only pipe int' can only be used as a function parameter}} |
19 | //TODO: fix parsing of this pipe int (*p); |
20 | } |
21 | |
22 | void test5(pipe int p) { |
23 | p+p; // expected-error{{invalid operands to binary expression ('read_only pipe int' and 'read_only pipe int')}} |
24 | p=p; // expected-error{{invalid operands to binary expression ('read_only pipe int' and 'read_only pipe int')}} |
25 | &p; // expected-error{{invalid argument type 'read_only pipe int' to unary expression}} |
26 | *p; // expected-error{{invalid argument type 'read_only pipe int' to unary expression}} |
27 | } |
28 | |
29 | typedef pipe int pipe_int_t; |
30 | pipe_int_t test6() {} // expected-error{{declaring function return value of type 'pipe_int_t' (aka 'read_only pipe int') is not allowed}} |
31 | |
32 | bool test_id_comprision(void) { |
33 | reserve_id_t id1, id2; |
34 | return (id1 == id2); // expected-error {{invalid operands to binary expression ('reserve_id_t' and 'reserve_id_t')}} |
35 | } |
36 | |
37 | // Tests ASTContext::mergeTypes rejects this. |
38 | int f(pipe int x, int y); // expected-note {{previous declaration is here}} |
39 | int f(x, y) // expected-error {{conflicting types for 'f}} |
40 | pipe short x; |
41 | int y; |
42 | { |
43 | return y; |
44 | } |
45 | |