summaryrefslogtreecommitdiff
path: root/test/SemaOpenCL
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-16 19:47:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-16 19:47:09 +0000
commit2410013d9382b8129702fa3a3bf19a370ae7afc3 (patch)
treedf038b6418b19d03437950dcee799c1483c6246a /test/SemaOpenCL
parent0a5fb09b599c1bdea3cd11168bb8f4ff4040316e (diff)
Notes
Diffstat (limited to 'test/SemaOpenCL')
-rw-r--r--test/SemaOpenCL/array-init.cl20
-rw-r--r--test/SemaOpenCL/storageclass.cl11
2 files changed, 30 insertions, 1 deletions
diff --git a/test/SemaOpenCL/array-init.cl b/test/SemaOpenCL/array-init.cl
new file mode 100644
index 0000000000000..d9691d86dd81e
--- /dev/null
+++ b/test/SemaOpenCL/array-init.cl
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
+// expected-no-diagnostics
+
+__kernel void k1(queue_t q1, queue_t q2) {
+ queue_t q[] = {q1, q2};
+}
+
+__kernel void k2(read_only pipe int p) {
+ reserve_id_t i1 = reserve_read_pipe(p, 1);
+ reserve_id_t i2 = reserve_read_pipe(p, 1);
+ reserve_id_t i[] = {i1, i2};
+}
+
+event_t create_event();
+__kernel void k3() {
+ event_t e1 = create_event();
+ event_t e2 = create_event();
+ event_t e[] = {e1, e2};
+}
+
diff --git a/test/SemaOpenCL/storageclass.cl b/test/SemaOpenCL/storageclass.cl
index a93f8244dcbd1..f457cfd1d3f60 100644
--- a/test/SemaOpenCL/storageclass.cl
+++ b/test/SemaOpenCL/storageclass.cl
@@ -5,7 +5,7 @@ constant int G2 = 0;
int G3 = 0; // expected-error{{program scope variable must reside in constant address space}}
global int G4 = 0; // expected-error{{program scope variable must reside in constant address space}}
-void kernel foo() {
+void kernel foo(int x) {
// static is not allowed at local scope before CL2.0
static int S1 = 5; // expected-error{{variables in function scope cannot be declared static}}
static constant int S2 = 5; // expected-error{{variables in function scope cannot be declared static}}
@@ -15,6 +15,12 @@ void kernel foo() {
auto int L3 = 7; // expected-error{{OpenCL version 1.2 does not support the 'auto' storage class specifier}}
global int L4; // expected-error{{function scope variable cannot be declared in global address space}}
+
+ constant int L5 = x; // expected-error {{initializer element is not a compile-time constant}}
+ global int *constant L6 = &G4;
+ private int *constant L7 = &x; // expected-error {{initializer element is not a compile-time constant}}
+ constant int *constant L8 = &L1;
+ local int *constant L9 = &L2; // expected-error {{initializer element is not a compile-time constant}}
}
static void kernel bar() { // expected-error{{kernel functions cannot be declared static}}
@@ -29,4 +35,7 @@ void f() {
}
global int L3; // expected-error{{function scope variable cannot be declared in global address space}}
extern constant float L4;
+ extern local float L5; // expected-error{{extern variable must reside in constant address space}}
+ static int L6 = 0; // expected-error{{variables in function scope cannot be declared static}}
+ static int L7; // expected-error{{variables in function scope cannot be declared static}}
}