blob: a0b33d48dbf79be71edb3ea4fee1ab37b7bf36b8 [file] [log] [blame]
Egor Churaev89831422016-12-23 14:55:49 +00001// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
2extern queue_t get_default_queue();
3
Sven van Haastregt0ea28c02018-09-25 12:59:34 +00004void queue_arg(queue_t); // expected-note {{passing argument to parameter here}}
Egor Churaev89831422016-12-23 14:55:49 +00005
6void init() {
Anastasia Stulova869d17d2019-12-27 13:38:48 +00007 queue_t q1 = 1; // expected-error{{initializing '__private queue_t' with an expression of incompatible type 'int'}}
Egor Churaev89831422016-12-23 14:55:49 +00008 queue_t q = 0;
9}
Sven van Haastregt0ea28c02018-09-25 12:59:34 +000010
11void assign() {
12 queue_t q2, q3;
Anastasia Stulova869d17d2019-12-27 13:38:48 +000013 q2 = 5; // expected-error{{assigning to '__private queue_t' from incompatible type 'int'}}
Sven van Haastregt0ea28c02018-09-25 12:59:34 +000014 q3 = 0;
15 q2 = q3 = 0;
16}
17
18bool compare() {
19 queue_t q4, q5;
20 return 1 == get_default_queue() && // expected-error{{invalid operands to binary expression ('int' and 'queue_t')}}
21 get_default_queue() == 1 && // expected-error{{invalid operands to binary expression ('queue_t' and 'int')}}
22 q4 == q5 &&
23 q4 != 0 &&
Anastasia Stulova869d17d2019-12-27 13:38:48 +000024 q4 != 0.0f; // expected-error{{invalid operands to binary expression ('__private queue_t' and 'float')}}
Sven van Haastregt0ea28c02018-09-25 12:59:34 +000025}
26
27void call() {
28 queue_arg(5); // expected-error {{passing 'int' to parameter of incompatible type 'queue_t'}}
29 queue_arg(0);
30}