summaryrefslogtreecommitdiffstats
path: root/test/SemaOpenCL
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2013-04-05 20:14:50 +0000
committerTanya Lattner <tonic@nondot.org>2013-04-05 20:14:50 +0000
commit8aa86d1155fb99e34fd084d83da3345b1ec2b2e4 (patch)
tree71dad425d0215af9c70fb9037e51327d0e017e75 /test/SemaOpenCL
parent5238e40f6ea6346b6bc1505e4975c2c4ab7fde09 (diff)
Add an error to check that all program scope variables are in the constant address space in OpenCL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaOpenCL')
-rw-r--r--test/SemaOpenCL/event_t.cl2
-rw-r--r--test/SemaOpenCL/storageclass.cl2
2 files changed, 3 insertions, 1 deletions
diff --git a/test/SemaOpenCL/event_t.cl b/test/SemaOpenCL/event_t.cl
index 57a0981cf1..06197d0c17 100644
--- a/test/SemaOpenCL/event_t.cl
+++ b/test/SemaOpenCL/event_t.cl
@@ -2,7 +2,7 @@
event_t glb_evt; // expected-error {{the event_t type cannot be used to declare a program scope variable}}
-struct evt_s {
+constant struct evt_s {
event_t evt; // expected-error {{the event_t type cannot be used to declare a structure or union field}}
} evt_str;
diff --git a/test/SemaOpenCL/storageclass.cl b/test/SemaOpenCL/storageclass.cl
index fdfe134621..d2678f2010 100644
--- a/test/SemaOpenCL/storageclass.cl
+++ b/test/SemaOpenCL/storageclass.cl
@@ -2,6 +2,8 @@
static constant int A = 0;
+int X = 0; // expected-error{{global variables must have a constant address space qualifier}}
+
// static is not allowed at local scope.
void kernel foo() {
static int X = 5; // expected-error{{variables in function scope cannot be declared static}}