summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaOpenCL
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaOpenCL')
-rw-r--r--clang/test/SemaOpenCL/null_queue.cl12
-rw-r--r--clang/test/SemaOpenCL/queue_t_overload.cl12
2 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/SemaOpenCL/null_queue.cl b/clang/test/SemaOpenCL/null_queue.cl
new file mode 100644
index 00000000000..518f7138de6
--- /dev/null
+++ b/clang/test/SemaOpenCL/null_queue.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
+extern queue_t get_default_queue();
+
+bool compare() {
+ return 1 == get_default_queue() && // expected-error{{invalid operands to binary expression ('int' and 'queue_t')}}
+ get_default_queue() == 1; // expected-error{{invalid operands to binary expression ('queue_t' and 'int')}}
+}
+
+void init() {
+ queue_t q1 = 1; // expected-error{{initializing 'queue_t' with an expression of incompatible type 'int'}}
+ queue_t q = 0;
+}
diff --git a/clang/test/SemaOpenCL/queue_t_overload.cl b/clang/test/SemaOpenCL/queue_t_overload.cl
new file mode 100644
index 00000000000..0048895ac80
--- /dev/null
+++ b/clang/test/SemaOpenCL/queue_t_overload.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
+
+void __attribute__((overloadable)) foo(queue_t, __local char *); // expected-note {{candidate function not viable: no known conversion from 'int' to 'queue_t' for 1st argument}} // expected-note {{candidate function}}
+void __attribute__((overloadable)) foo(queue_t, __local float *); // expected-note {{candidate function not viable: no known conversion from 'int' to 'queue_t' for 1st argument}} // expected-note {{candidate function}}
+
+void kernel ker(__local char *src1, __local float *src2, __global int *src3) {
+ queue_t q;
+ foo(q, src1);
+ foo(0, src2);
+ foo(q, src3); // expected-error {{call to 'foo' is ambiguous}}
+ foo(1, src3); // expected-error {{no matching function for call to 'foo'}}
+}
OpenPOWER on IntegriCloud