1// RUN: %clang_cc1 %s -pedantic -verify -fsyntax-only
2
3template<typename T>
4T global_variable; // expected-error{{the '__global clk_event_t' type cannot be used to declare a program scope variable}}
5
6clk_event_t global_event; // expected-error{{the '__global clk_event_t' type cannot be used to declare a program scope variable}}
7
8template<typename T>
9void templ() {
10  T loc;
11  // expected-error@-1{{type '__private __read_only image1d_t' can only be used as a function parameter in OpenCL}}
12  // expected-error@-2{{declaring variable of type '__private half' is not allowed}}
13  // expected-error@-3{{the event_t type can only be used with __private address space qualifier}}
14}
15
16void foo() {
17  templ<image1d_t>(); // expected-note{{in instantiation of function template specialization 'templ<__read_only image1d_t>' requested here}}
18  templ<half>(); // expected-note{{in instantiation of function template specialization 'templ<half>' requested here}}
19  templ<__local event_t>(); // expected-note{{in instantiation of function template specialization 'templ<__local event_t>' requested here}}
20
21  image1d_t img; // expected-error{{type '__private __read_only image1d_t' can only be used as a function parameter in OpenCL}}
22  half h; // expected-error{{declaring variable of type '__private half' is not allowed}}
23  __local event_t e; // expected-error{{the event_t type can only be used with __private address space qualifier}}
24
25  (void) global_variable<clk_event_t>; // expected-note{{in instantiation of variable template specialization 'global_variable' requested here}}
26}
27