aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/ext/vector23.C
blob: 461d8a9e969973f0de60c5023a5a7e5310e6d4d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* { dg-do compile { target c++1y } } */
/* { dg-options "-Wsign-conversion" } */
// Ignore warning on some powerpc-linux configurations.
// { dg-prune-output "non-standard ABI extension" }
// Ignore warning on Linux/x86
// { dg-prune-output "changes the ABI" }

typedef double vecd __attribute__((vector_size(4*sizeof(double))));
typedef float vecf __attribute__((vector_size(8*sizeof(float))));
typedef long vecl __attribute__((vector_size(4*sizeof(long))));
typedef short vecs __attribute__((vector_size(8*sizeof(short))));
typedef char vecc __attribute__((vector_size(16*sizeof(char))));

auto f(vecf*a,float d,long long i){
  return (*a<0)?d:i; // { dg-error "truncation" }
}
auto g(vecc*a){
  return (*a<0)?3LL:42UL; // { dg-error "inferred scalar type" }
}
auto h(vecd*a){
  return (*a<0)?'a':'c'; // { dg-error "inferred scalar type \[^\\n\]*double" }
}
auto i(vecc*a){
  return (*a<0)?1:0.; // { dg-error "inferred scalar type" }
}
auto j(vecl*a,long i,unsigned long k){
  return (*a<0)?i:k; // { dg-warning "may change the sign" }
}