Debian Codegraph @

gcc/testsuite/g++.dg/ext/vector23.C

raw
1 /* { dg-do compile { target c++14 } } */
2 /* { dg-options "-Wsign-conversion" } */
3 // Ignore warning on some powerpc-linux configurations.
4 // { dg-prune-output "non-standard ABI extension" }
5 // Ignore warning on Linux/x86
6 // { dg-prune-output "changes the ABI" }
7
8 typedef double vecd __attribute__((vector_size(4*sizeof(double))));
9 typedef float vecf __attribute__((vector_size(8*sizeof(float))));
10 typedef long vecl __attribute__((vector_size(4*sizeof(long))));
11 typedef short vecs __attribute__((vector_size(8*sizeof(short))));
12 typedef char vecc __attribute__((vector_size(16*sizeof(char))));
13
14 auto f(vecf*a,float d,long long i){
15 return (*a<0)?d:i; // { dg-error "truncation" }
16 }
17 auto g(vecc*a){
18 return (*a<0)?3LL:42UL; // { dg-error "inferred scalar type" }
19 }
20 auto h(vecd*a){
21 return (*a<0)?'a':'c'; // { dg-error "inferred scalar type \[^\\n\]*double" }
22 }
23 auto i(vecc*a){
24 return (*a<0)?1:0.; // { dg-error "inferred scalar type" }
25 }
26 auto j(vecl*a,long i,unsigned long k){
27 return (*a<0)?i:k; // { dg-warning "may change the sign" }
28 }