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