• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
2
3constant sampler_t glb_smp = 5;
4
5void foo(sampler_t);
6
7constant 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
11void 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
20void bad(sampler_t*); // expected-error{{pointer to type 'sampler_t' is invalid in OpenCL}}
21
22void 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
31sampler_t bad(); //expected-error{{declaring function return value of type 'sampler_t' is not allowed}}
32