Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaOpenCL / invalid-pipes-cl1.2.cl
blob2ea6d3bc4862d3a458186d37e4daec9bebb7512f
1 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
2 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=-all
3 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=-all
5 void foo(read_only pipe int p);
6 #if __OPENCL_C_VERSION__ > 120
7 // expected-error@-2 {{OpenCL C version 3.0 does not support the 'pipe' type qualifier}}
8 // expected-error@-3 {{access qualifier can only be used for pipe and image type}}
9 #elif defined(__OPENCL_CPP_VERSION__)
10 // expected-error@-5 {{C++ for OpenCL version 2021 does not support the 'pipe' type qualifier}}
11 // expected-error@-6 {{access qualifier can only be used for pipe and image type}}
12 #else
13 // expected-error@-8 {{type specifier missing, defaults to 'int'}}
14 // expected-error@-9 {{access qualifier can only be used for pipe and image type}}
15 // expected-error@-10 {{expected ')'}} expected-note@-10 {{to match this '('}}
16 #endif
18 // 'pipe' should be accepted as an identifier.
19 typedef int pipe;
20 #if __OPENCL_C_VERSION__ > 120
21 // expected-error@-2 {{OpenCL C version 3.0 does not support the 'pipe' type qualifier}}
22 // expected-warning@-3 {{typedef requires a name}}
23 #elif defined(__OPENCL_CPP_VERSION__)
24 // expected-error@-5 {{C++ for OpenCL version 2021 does not support the 'pipe' type qualifier}}
25 // expected-warning@-6 {{typedef requires a name}}
26 #endif
28 void bar(void) {
29 reserve_id_t r;
30 #if defined(__OPENCL_C_VERSION__)
31 // expected-error@-2 {{use of undeclared identifier 'reserve_id_t'}}
32 #else
33 // expected-error@-4 {{unknown type name 'reserve_id_t'}}
34 #endif