1*67e74705SXin Li// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only 2*67e74705SXin Li 3*67e74705SXin Liconstant sampler_t glb_smp = 5; 4*67e74705SXin Li 5*67e74705SXin Livoid foo(sampler_t); 6*67e74705SXin Li 7*67e74705SXin Liconstant struct sampler_s { 8*67e74705SXin Li sampler_t smp; // expected-error{{the 'sampler_t' type cannot be used to declare a structure or union field}} 9*67e74705SXin Li} sampler_str = {0}; 10*67e74705SXin Li 11*67e74705SXin Livoid kernel ker(sampler_t argsmp) { 12*67e74705SXin Li local sampler_t smp; // expected-error{{sampler type cannot be used with the __local and __global address space qualifiers}} 13*67e74705SXin Li const sampler_t const_smp = 7; 14*67e74705SXin Li foo(glb_smp); 15*67e74705SXin Li foo(const_smp); 16*67e74705SXin Li foo(5); // expected-error{{sampler_t variable required - got 'int'}} 17*67e74705SXin Li sampler_t sa[] = {argsmp, const_smp}; // expected-error {{array of 'sampler_t' type is invalid in OpenCL}} 18*67e74705SXin Li} 19*67e74705SXin Li 20*67e74705SXin Livoid bad(sampler_t*); // expected-error{{pointer to type 'sampler_t' is invalid in OpenCL}} 21*67e74705SXin Li 22*67e74705SXin Livoid bar() { 23*67e74705SXin Li sampler_t smp1 = 7; 24*67e74705SXin Li sampler_t smp2 = 2; 25*67e74705SXin Li smp1=smp2; //expected-error{{invalid operands to binary expression ('sampler_t' and 'sampler_t')}} 26*67e74705SXin Li smp1+1; //expected-error{{invalid operands to binary expression ('sampler_t' and 'int')}} 27*67e74705SXin Li &smp1; //expected-error{{invalid argument type 'sampler_t' to unary expression}} 28*67e74705SXin Li *smp2; //expected-error{{invalid argument type 'sampler_t' to unary expression}} 29*67e74705SXin Li} 30*67e74705SXin Li 31*67e74705SXin Lisampler_t bad(); //expected-error{{declaring function return value of type 'sampler_t' is not allowed}} 32