diff options
| author | Alexey Bader <aleksey.bader@mail.ru> | 2016-11-29 10:21:40 +0000 |
|---|---|---|
| committer | Alexey Bader <aleksey.bader@mail.ru> | 2016-11-29 10:21:40 +0000 |
| commit | c211c6c8844a46f8ac795ef7998b81772bc99103 (patch) | |
| tree | 6ed39f052d22484e375b831e8c99db89397fb19c /clang/test | |
| parent | bba2d59ea49d4ee27f9b532e6da7a5f3c0eec084 (diff) | |
| download | bcm5719-llvm-c211c6c8844a46f8ac795ef7998b81772bc99103.tar.gz bcm5719-llvm-c211c6c8844a46f8ac795ef7998b81772bc99103.zip | |
[OpenCL] Prohibit using reserve_id_t in program scope.
Patch by Egor Churaev (echuraev).
Reviewers: Anastasia
Subscribers: cfe-commits, yaxunl, bader
Differential Revision: https://reviews.llvm.org/D27099
llvm-svn: 288126
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaOpenCL/event_t.cl | 2 | ||||
| -rw-r--r-- | clang/test/SemaOpenCL/invalid-clk-events-cl2.0.cl | 3 | ||||
| -rw-r--r-- | clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl | 8 |
3 files changed, 12 insertions, 1 deletions
diff --git a/clang/test/SemaOpenCL/event_t.cl b/clang/test/SemaOpenCL/event_t.cl index 990c0634094..e7daf88576c 100644 --- a/clang/test/SemaOpenCL/event_t.cl +++ b/clang/test/SemaOpenCL/event_t.cl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -event_t glb_evt; // expected-error {{the event_t type cannot be used to declare a program scope variable}} +event_t glb_evt; // expected-error {{the 'event_t' type cannot be used to declare a program scope variable}} constant struct evt_s { event_t evt; // expected-error {{the 'event_t' type cannot be used to declare a structure or union field}} diff --git a/clang/test/SemaOpenCL/invalid-clk-events-cl2.0.cl b/clang/test/SemaOpenCL/invalid-clk-events-cl2.0.cl new file mode 100644 index 00000000000..8c8e1c61761 --- /dev/null +++ b/clang/test/SemaOpenCL/invalid-clk-events-cl2.0.cl @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 + +global clk_event_t ce; // expected-error {{the '__global clk_event_t' type cannot be used to declare a program scope variable}} diff --git a/clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl b/clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl index 96874a089c9..c425bc91265 100644 --- a/clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl +++ b/clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl @@ -1,5 +1,8 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 +global pipe int gp; // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}} +global reserve_id_t rid; // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}} + void test1(pipe int *p) {// expected-error {{pipes packet types cannot be of reference type}} } void test2(pipe p) {// expected-error {{missing actual type specifier for pipe}} @@ -20,3 +23,8 @@ void test5(pipe int p) { typedef pipe int pipe_int_t; pipe_int_t test6() {} // expected-error{{declaring function return value of type 'pipe_int_t' (aka 'read_only pipe int') is not allowed}} + +bool test_id_comprision(void) { + reserve_id_t id1, id2; + return (id1 == id2); // expected-error {{invalid operands to binary expression ('reserve_id_t' and 'reserve_id_t')}} +} |

