[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaOpenCL / vec_step.cl
blobafb6dc94d92e5ec615e78e47cc5f9576dda95b5a
1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
3 typedef int int2 __attribute__((ext_vector_type(2)));
4 typedef int int3 __attribute__((ext_vector_type(3)));
5 typedef int int4 __attribute__((ext_vector_type(4)));
6 typedef int int8 __attribute__((ext_vector_type(8)));
7 typedef int int16 __attribute__((ext_vector_type(16)));
9 void foo(int3 arg1, int8 arg2) {
10 int4 auto1;
11 int16 *auto2;
12 int auto3;
13 int2 auto4;
14 struct S *incomplete1;
16 int res1[vec_step(arg1) == 4 ? 1 : -1];
17 int res2[vec_step(arg2) == 8 ? 1 : -1];
18 int res3[vec_step(auto1) == 4 ? 1 : -1];
19 int res4[vec_step(*auto2) == 16 ? 1 : -1];
20 int res5[vec_step(auto3) == 1 ? 1 : -1];
21 int res6[vec_step(auto4) == 2 ? 1 : -1];
22 int res7[vec_step(int2) == 2 ? 1 : -1];
23 int res8[vec_step(int3) == 4 ? 1 : -1];
24 int res9[vec_step(int4) == 4 ? 1 : -1];
25 int res10[vec_step(int8) == 8 ? 1 : -1];
26 int res11[vec_step(int16) == 16 ? 1 : -1];
27 int res12[vec_step(void) == 1 ? 1 : -1];
29 int res13 = vec_step(*incomplete1); // expected-error {{'vec_step' requires built-in scalar or vector type, '__private struct S' invalid}}
30 int res14 = vec_step(int16*); // expected-error {{'vec_step' requires built-in scalar or vector type, '__private int16 *' invalid}}
31 int res15 = vec_step(void(void)); // expected-error {{'vec_step' requires built-in scalar or vector type, 'void (void)' invalid}}
33 int res_no_effect = vec_step(auto3++); // expected-warning {{expression with side effects has no effect in an unevaluated context}}