view gcc/testsuite/g++.dg/ext/vector23.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile { target c++14 } } */
/* { 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" }
}