xref: /llvm-project/clang/test/SemaOpenCL/vector_inc_dec_ops.cl (revision 0e890904ea342aba088ed2a55b537ffdb0562234)
1// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
2
3typedef __attribute__((ext_vector_type(2)))  char char2;
4typedef __attribute__((ext_vector_type(4)))  unsigned int uint4;
5typedef __attribute__((ext_vector_type(8)))  long long8;
6typedef __attribute__((ext_vector_type(4)))  float float4;
7
8void vectorIncrementDecrementOps(void)
9{
10  char2 A = (char2)(1);
11  uint4 B = (uint4)(1);
12  long8 C = (long8)(1);
13
14  A++;
15  --A;
16  B--;
17  ++B;
18  C++;
19}
20
21void invalidIncrementDecrementOps(void) {
22  ((float4)(1.0f))++; // expected-error{{cannot increment value of type 'float4'}}
23  float4 i;
24  ++i; // expected-error{{cannot increment value of type '__private float4'}}
25  i--; // expected-error{{cannot decrement value of type '__private float4'}}
26}
27