Debian Codegraph @

clang/test/SemaOpenCL/vector_inc_dec_ops.cl

raw
1 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
2
3 typedef __attribute__((ext_vector_type(2))) char char2;
4 typedef __attribute__((ext_vector_type(4))) unsigned int uint4;
5 typedef __attribute__((ext_vector_type(8))) long long8;
6 typedef __attribute__((ext_vector_type(4))) float float4;
7
8 void 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
21 void 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 }