2009-04-18 02:39:25 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only %s -verify -Wvector-conversions
|
2007-11-27 13:51:55 +08:00
|
|
|
|
|
|
|
typedef long long t1 __attribute__ ((vector_size (8)));
|
|
|
|
typedef char t2 __attribute__ ((vector_size (16)));
|
|
|
|
typedef float t3 __attribute__ ((vector_size (16)));
|
|
|
|
|
|
|
|
void f()
|
|
|
|
{
|
|
|
|
t1 v1;
|
|
|
|
t2 v2;
|
|
|
|
t3 v3;
|
|
|
|
|
|
|
|
v2 = (t2)v1; // -expected-error {{invalid conversion between vector type \
|
|
|
|
't2' and 't1' of different size}}
|
2009-06-26 08:50:28 +08:00
|
|
|
v1 = (t1)v2; // -expected-error {{invalid conversion between vector type \
|
|
|
|
't1' and 't2' of different size}}
|
2007-11-27 13:51:55 +08:00
|
|
|
v3 = (t3)v2;
|
|
|
|
|
|
|
|
v1 = (t1)(char *)10; // -expected-error {{invalid conversion between vector \
|
|
|
|
type 't1' and scalar type 'char *'}}
|
|
|
|
v1 = (t1)(long long)10;
|
|
|
|
v1 = (t1)(short)10; // -expected-error {{invalid conversion between vector \
|
2009-08-16 03:02:19 +08:00
|
|
|
type 't1' and integer type 'short' of different size}}
|
2007-11-27 13:51:55 +08:00
|
|
|
|
|
|
|
long long r1 = (long long)v1;
|
|
|
|
short r2 = (short)v1; // -expected-error {{invalid conversion between vector \
|
|
|
|
type 't1' and integer type 'short' of different size}}
|
|
|
|
char *r3 = (char *)v1; // -expected-error {{invalid conversion between vector\
|
|
|
|
type 't1' and scalar type 'char *'}}
|
|
|
|
}
|
2009-04-18 02:39:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
void f2(t2 X);
|
|
|
|
|
|
|
|
void f3(t3 Y) {
|
|
|
|
f2(Y); // expected-warning {{incompatible vector types passing 't3', expected 't2'}}
|
|
|
|
}
|
|
|
|
|