]> granicus.if.org Git - clang/commitdiff
Print detailed vector type information on diagnostics.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 25 Apr 2014 20:41:38 +0000 (20:41 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 25 Apr 2014 20:41:38 +0000 (20:41 +0000)
We never aka vector types because our attributed syntax for it is less
comprehensible than the typedefs. This leaves the user in the dark when
the typedef isn't named that well.

Example:
  v2s v; v4f w;
  w = v;

The naming in this cases isn't even that bad, but the error we give is
useless without looking up the actual typedefs.
t.c:6:5: error: assigning to 'v4f' from incompatible type 'v2s'

Now:
t.c:6:5: error: assigning to 'v4f' (vector of 4 'float' values) from
    incompatible type 'v2s' (vector of 2 'int' values)

We do this for all diagnostics that print a vector type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207267 91177308-0d34-0410-b5e6-96231b3b80d8

15 files changed:
lib/AST/ASTDiagnostic.cpp
test/CodeGen/mmx-inline-asm-error.c
test/Parser/altivec.c
test/Parser/cxx-altivec.cpp
test/Parser/opencl-astype.cl
test/Sema/ext_vector_casts.c
test/Sema/transparent-union.c
test/Sema/typedef-retain.c
test/Sema/vector-assign.c
test/Sema/vector-cast.c
test/Sema/vector-init.c
test/Sema/vector-ops.c
test/SemaCXX/vector-casts.cpp
test/SemaCXX/vector.cpp
test/SemaOpenCL/vector_conv_invalid.cl

index 7c6bec4503f32f02ca704bc97431509cbc18f338..539e666a486bfedab6df51262871a6ae051c0d35 100644 (file)
@@ -228,6 +228,20 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty,
         return S;
       }
     }
+
+    // Give some additional info on vector types. These are either not desugared
+    // or displaying complex __attribute__ expressions so add details of the
+    // type and element count.
+    if (Ty->isVectorType()) {
+      const VectorType *VTy = Ty->getAs<VectorType>();
+      std::string DecoratedString;
+      llvm::raw_string_ostream OS(DecoratedString);
+      const char *Values = VTy->getNumElements() > 1 ? "values" : "value";
+      OS << "'" << S << "' (vector of " << VTy->getNumElements() << " '"
+         << VTy->getElementType().getAsString(Context.getPrintingPolicy())
+         << "' " << Values << ")";
+      return OS.str();
+    }
   }
 
   S = "'" + S + "'";
index a6393682ced1fbb32e448e718d5c92f969835b90..876c664e3b57071379bbd3a973435660020d033f 100644 (file)
@@ -4,9 +4,9 @@ typedef int vec256 __attribute__((ext_vector_type(8)));
 vec256 foo(vec256 in) {
   vec256 out;
 
-  asm("something %0" : : "y"(in)); // expected-error {{invalid type 'vec256' in asm input for constraint 'y'}}
-  asm("something %0" : "=y"(out)); // expected-error {{invalid type 'vec256' in asm input for constraint 'y'}}
-  asm("something %0, %0" : "+y"(out)); // expected-error {{invalid type 'vec256' in asm input for constraint 'y'}}
+  asm("something %0" : : "y"(in)); // expected-error {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
+  asm("something %0" : "=y"(out)); // expected-error {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
+  asm("something %0, %0" : "+y"(out)); // expected-error {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
 
   return out;
 }
index 0bdc3dcffe2a36947c60a9067304935b6921d92b..436a3afd2d0765342b1664c1d99197e11ea9ab1d 100644 (file)
@@ -103,8 +103,8 @@ void f() {
   gccvector unsigned int gv = v;
   gccvector int gvi = (gccvector int)v;
   __attribute__((vector_size(8))) unsigned int gv8;
-  gv8 = gccv;     // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
-  av = gv8;       // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+  gv8 = gccv;     // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int' (vector of 4 'unsigned int' values)}}
+  av = gv8;       // expected-error {{assigning to '__vector unsigned int' (vector of 4 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values)}}
 
   v = gccv;
   __vector unsigned int tv = gccv;
index be00e494fd53f9373405ba8310535a2d38911862..27cab2c9c411410b29175c579aab617c561b30a9 100644 (file)
@@ -93,8 +93,8 @@ void f() {
   gccvector unsigned int gv = v;
   gccvector int gvi = (gccvector int)v;
   __attribute__((vector_size(8))) unsigned int gv8;
-  gv8 = gccv;     // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
-  av = gv8;       // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+  gv8 = gccv;     // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int' (vector of 4 'unsigned int' values)}}
+  av = gv8;       // expected-error {{assigning to '__vector unsigned int' (vector of 4 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values)}}
 
   v = gccv;
   __vector unsigned int tv = gccv;
index d4c547e5cb823ac44f245839f834598df73f8277..72f98a4ace9ff131181cb3eb539b2489da89b02e 100644 (file)
@@ -11,7 +11,7 @@ void test_astype() {
   typedef __attribute__(( ext_vector_type(4) ))  double double4;
   
   float4 f4;
-  double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' and 'float4' must match}}
+  double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' (vector of 4 'double' values) and 'float4' (vector of 4 'float' values) must match}}
   
   // Verify int4->float3, float3->int4 works.
   int4 i4;
index d60bc3c65c8ca89d46332eda7056b8b7f74b6bd1..949d67311b36d7902fb61d3aca9c183d7da576e7 100644 (file)
@@ -32,30 +32,30 @@ static void test() {
     ivec4 = (int4)5;
     ivec4 = (int4)vec4_3;
     
-    i = (int)ivec4; // expected-error {{invalid conversion between vector type 'int4' and integer type 'int' of different size}}
-    i = ivec4; // expected-error {{assigning to 'int' from incompatible type 'int4'}}
+    i = (int)ivec4; // expected-error {{invalid conversion between vector type 'int4' (vector of 4 'int' values) and integer type 'int' of different size}}
+    i = ivec4; // expected-error {{assigning to 'int' from incompatible type 'int4' (vector of 4 'int' values)}}
     
-    ivec4 = (int4)ptr; // expected-error {{invalid conversion between vector type 'int4' and scalar type 'int *'}}
+    ivec4 = (int4)ptr; // expected-error {{invalid conversion between vector type 'int4' (vector of 4 'int' values) and scalar type 'int *'}}
     
-    vec4 = (float4)vec2; // expected-error {{invalid conversion between ext-vector type 'float4' and 'float2'}}
+    vec4 = (float4)vec2; // expected-error {{invalid conversion between ext-vector type 'float4' (vector of 4 'float' values) and 'float2' (vector of 2 'float' values)}}
   
     ish8 += 5;
     ivec4 *= 5;
      vec4 /= 5.2f;
-     vec4 %= 4; // expected-error {{invalid operands to binary expression ('float4' and 'int')}}
+     vec4 %= 4; // expected-error {{invalid operands to binary expression ('float4' (vector of 4 'float' values) and 'int')}}
     ivec4 %= 4;
-    ivec4 += vec4; // expected-error {{can't convert between vector values of different size ('int4' and 'float4')}}
+    ivec4 += vec4; // expected-error {{can't convert between vector values of different size ('int4' (vector of 4 'int' values) and 'float4' (vector of 4 'float' values))}}
     ivec4 += (int4)vec4;
     ivec4 -= ivec4;
     ivec4 |= ivec4;
-    ivec4 += ptr; // expected-error {{can't convert between vector and non-scalar values ('int4' and 'int *')}}
+    ivec4 += ptr; // expected-error {{can't convert between vector and non-scalar values ('int4' (vector of 4 'int' values) and 'int *')}}
 }
 
-typedef __attribute__(( ext_vector_type(2) )) float2 vecfloat2; // expected-error{{invalid vector element type 'float2'}}
+typedef __attribute__(( ext_vector_type(2) )) float2 vecfloat2; // expected-error{{invalid vector element type 'float2' (vector of 2 'float' values)}}
 
 void inc(float2 f2) {
-  f2++; // expected-error{{cannot increment value of type 'float2'}}
-  __real f2; // expected-error{{invalid type 'float2' to __real operator}}
+  f2++; // expected-error{{cannot increment value of type 'float2' (vector of 2 'float' values)}}
+  __real f2; // expected-error{{invalid type 'float2' (vector of 2 'float' values) to __real operator}}
 }
 
 typedef enum
@@ -86,7 +86,7 @@ typedef float C3DVector3 __attribute__((ext_vector_type(3)));
 extern float32x4_t vabsq_f32(float32x4_t __a);
 
 C3DVector3 Func(const C3DVector3 a) {
-    return (C3DVector3)vabsq_f32((float32x4_t)a); // expected-error {{invalid conversion between ext-vector type 'float32x4_t' and 'C3DVector3'}}
+    return (C3DVector3)vabsq_f32((float32x4_t)a); // expected-error {{invalid conversion between ext-vector type 'float32x4_t' (vector of 4 'float' values) and 'C3DVector3' (vector of 3 'float' values)}}
 }
 
 // rdar://16350802
@@ -99,7 +99,7 @@ static void splats(int i, long l, __uint128_t t, float f, double d) {
   float2 vf = f;
   double2 vd = d;
   
-  vs = 65536 + vs; // expected-warning {{implicit conversion from 'int' to 'short8' changes value from 65536 to 0}}
+  vs = 65536 + vs; // expected-warning {{implicit conversion from 'int' to 'short8' (vector of 8 'short' values) changes value from 65536 to 0}}
   vs = vs + i; // expected-warning {{implicit conversion loses integer precision}}
   vs = vs + 1;
   vs = vs + 1.f; // expected-error {{can't convert between vector values of different size}}
index eff7df67b9ad1ba4bc06fad0eaa8a3438c0678dd..8ef70bb1c7e32deb85e7c037ee1a3a7b90434940 100644 (file)
@@ -67,7 +67,7 @@ typedef union { } TU4 __attribute__((transparent_union)); // expected-warning{{f
 
 typedef int int4 __attribute__((ext_vector_type(4)));
 typedef union {
-  int4 vec; // expected-warning{{first field of a transparent union cannot have vector type 'int4'; transparent_union attribute ignored}}
+  int4 vec; // expected-warning{{first field of a transparent union cannot have vector type 'int4' (vector of 4 'int' values); transparent_union attribute ignored}}
 } TU5 __attribute__((transparent_union));
 
 union pr15134 {
index a7173b78779139d10913785f4949f4d9e923de51..d216466360b7c7c999a8337ade6d86a887008263 100644 (file)
@@ -5,11 +5,11 @@ typedef int int4 __attribute__((vector_size(16)));
 typedef int4* int4p;
 
 void test1(float4 a, int4 *result, int i) {
-    result[i] = a; // expected-error {{assigning to 'int4' from incompatible type 'float4'}}
+    result[i] = a; // expected-error {{assigning to 'int4' (vector of 4 'int' values) from incompatible type 'float4' (vector of 4 'float' values)}}
 }
 
 void test2(float4 a, int4p result, int i) {
-    result[i] = a; // expected-error {{assigning to 'int4' from incompatible type 'float4'}}
+    result[i] = a; // expected-error {{assigning to 'int4' (vector of 4 'int' values) from incompatible type 'float4' (vector of 4 'float' values)}}
 }
 
 // PR2039
index f01eb456a164654c03fc1f8764d16dc36d3326ec..ad3406e304a783d800b205dac91e2e157c354e90 100644 (file)
@@ -12,30 +12,30 @@ void test1() {
   v2f v4;
   v4ss v5;
   
-  v1 = v2; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v2u'}}
-  v1 = v3; // expected-error {{assigning to 'v2s' from incompatible type 'v1s'}}
-  v1 = v4; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v2f'}}
-  v1 = v5; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v4ss'}}
+  v1 = v2; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v2u' (vector of 2 'unsigned int' values)}}
+  v1 = v3; // expected-error {{assigning to 'v2s' (vector of 2 'int' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
+  v1 = v4; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v2f' (vector of 2 'float' values)}}
+  v1 = v5; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v4ss' (vector of 4 'short' values)}}
   
-  v2 = v1; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v2s'}}
-  v2 = v3; // expected-error {{assigning to 'v2u' from incompatible type 'v1s'}}
-  v2 = v4; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v2f'}}
-  v2 = v5; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v4ss'}}
+  v2 = v1; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v2s' (vector of 2 'int' values)}}
+  v2 = v3; // expected-error {{assigning to 'v2u' (vector of 2 'unsigned int' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
+  v2 = v4; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v2f' (vector of 2 'float' values)}}
+  v2 = v5; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v4ss' (vector of 4 'short' values)}}
   
-  v3 = v1; // expected-error {{assigning to 'v1s' from incompatible type 'v2s'}}
-  v3 = v2; // expected-error {{assigning to 'v1s' from incompatible type 'v2u'}}
-  v3 = v4; // expected-error {{assigning to 'v1s' from incompatible type 'v2f'}}
-  v3 = v5; // expected-error {{assigning to 'v1s' from incompatible type 'v4ss'}}
+  v3 = v1; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2s' (vector of 2 'int' values)}}
+  v3 = v2; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2u' (vector of 2 'unsigned int' values)}}
+  v3 = v4; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2f' (vector of 2 'float' values)}}
+  v3 = v5; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v4ss'}}
   
-  v4 = v1; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v2s'}}
-  v4 = v2; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v2u'}}
-  v4 = v3; // expected-error {{assigning to 'v2f' from incompatible type 'v1s'}}
-  v4 = v5; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v4ss'}}
+  v4 = v1; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v2s' (vector of 2 'int' values)}}
+  v4 = v2; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v2u' (vector of 2 'unsigned int' values)}}
+  v4 = v3; // expected-error {{assigning to 'v2f' (vector of 2 'float' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
+  v4 = v5; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v4ss' (vector of 4 'short' values)}}
   
-  v5 = v1; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2s'}}
-  v5 = v2; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2u'}}
-  v5 = v3; // expected-error {{assigning to 'v4ss' from incompatible type 'v1s'}}
-  v5 = v4; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2f'}}
+  v5 = v1; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2s' (vector of 2 'int' values)}}
+  v5 = v2; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2u' (vector of 2 'unsigned int' values)}}
+  v5 = v3; // expected-error {{assigning to 'v4ss' (vector of 4 'short' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
+  v5 = v4; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2f'}}
 }
 
 // PR2263
index bfc731e7b0a0100ed05a6be8004bd0541f3b7177..6d22deec9464bfe2f7fb12322a5cd161fa314372 100644 (file)
@@ -11,29 +11,29 @@ void f()
   t3 v3;
   
   v2 = (t2)v1; // expected-error {{invalid conversion between vector type \
-'t2' and 't1' of different size}}
+'t2' (vector of 16 'char' values) and 't1' (vector of 1 'long long' value) of different size}}
   v1 = (t1)v2; // expected-error {{invalid conversion between vector type \
-'t1' and 't2' of different size}}
+'t1' (vector of 1 'long long' value) and 't2' (vector of 16 'char' values) of different size}}
   v3 = (t3)v2;
   
   v1 = (t1)(char *)10; // expected-error {{invalid conversion between vector \
-type 't1' and scalar type 'char *'}}
+type 't1' (vector of 1 'long long' value) and scalar type 'char *'}}
   v1 = (t1)(long long)10;
   v1 = (t1)(short)10; // expected-error {{invalid conversion between vector \
-type 't1' and integer type 'short' of different size}}
+type 't1' (vector of 1 'long long' value) and integer type 'short' of different size}}
   
   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}}
+type 't1' (vector of 1 'long long' value) and integer type 'short' of different size}}
   char *r3 = (char *)v1; // expected-error {{invalid conversion between vector\
- type 't1' and scalar type 'char *'}}
+ type 't1' (vector of 1 'long long' value) and scalar type 'char *'}}
 }
 
 
 void f2(t2 X); // expected-note{{passing argument to parameter 'X' here}}
 
 void f3(t3 Y) {
-  f2(Y);  // expected-warning {{incompatible vector types passing 't3' to parameter of type 't2'}}
+  f2(Y);  // expected-warning {{incompatible vector types passing 't3' (vector of 4 'float' values) to parameter of type 't2' (vector of 16 'char' values)}}
 }
 
 typedef float float2 __attribute__ ((vector_size (8)));
@@ -51,6 +51,6 @@ typedef short short_sizeof_pointer __attribute__((vector_size(sizeof(void*))));
 void f5() {
   short_sizeof_pointer v;
   void *ptr;
-  v = ptr; // expected-error {{assigning to 'short_sizeof_pointer' from incompatible type 'void *'}}
+  v = ptr; // expected-error {{assigning to 'short_sizeof_pointer' (vector of 4 'short' values) from incompatible type 'void *'}}
   ptr = v; // expected-error {{assigning to 'void *' from incompatible type 'short_sizeof_pointer'}}
 }
index 5be040ae6c11d4ce3fa95830bfee966d31bca170..9f27bb882e6672a254ad72949c268aae9f35a09e 100644 (file)
@@ -40,5 +40,5 @@ typedef short __attribute__((vector_size(8))) short4;
 void test3() {
   extern short8 test3_helper(void);
   longlong2 arr1[2] = { test3_helper(), test3_helper() };
-  short4 arr2[2] = { test3_helper(), test3_helper() }; // expected-error 2 {{initializing 'short4' with an expression of incompatible type 'short8'}}
+  short4 arr2[2] = { test3_helper(), test3_helper() }; // expected-error 2 {{initializing 'short4' (vector of 4 'short' values) with an expression of incompatible type 'short8' (vector of 8 'short' values)}}
 }
index 652a076c780fa988392db4e5cc847d090f73a9b8..f2953417f545ec23c82c8a4046b4703b5d12136c 100644 (file)
@@ -10,14 +10,14 @@ void test1(v2u v2ua, v2s v2sa, v2f v2fa) {
 
   // Unary operators
   (void)(~v2ua);
-  (void)(~v2fa); // expected-error{{invalid argument type 'v2f' to unary}}
+  (void)(~v2fa); // expected-error{{invalid argument type 'v2f' (vector of 2 'float' values) to unary}}
 
   // Comparison operators
-  v2ua = (v2ua==v2sa); // expected-warning{{incompatible vector types assigning to 'v2u' from 'int __attribute__((ext_vector_type(2)))'}}
+  v2ua = (v2ua==v2sa); // expected-warning{{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'int __attribute__((ext_vector_type(2)))' (vector of 2 'int' values)}}
   v2sa = (v2ua==v2sa);
   
   // Arrays
-  int array1[v2ua]; // expected-error{{size of array has non-integer type 'v2u'}}
+  int array1[v2ua]; // expected-error{{size of array has non-integer type 'v2u' (vector of 2 'unsigned int' values)}}
   int array2[17];
   // FIXME: error message below needs type!
   (void)(array2[v2ua]); // expected-error{{array subscript is not an integer}}
index 3aa097b652bc151a897271b4f0caf2aec31862b9..2ccd5979c7f7ba0f12312f35f0477fd44e50e049 100644 (file)
@@ -23,19 +23,19 @@ void f() {
   (void)reinterpret_cast<__v2si>(ll);
   (void)(__v2si)(ll);
 
-  (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' to 'S' is not allowed}}
-  (void)(S)v2si; // expected-error {{no matching conversion for C-style cast from '__v2si' to 'S'}}
-  (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'S' to '__v2si' is not allowed}}
-  (void)(__v2si)s; // expected-error {{cannot convert 'S' to '__v2si' without a conversion operator}}
+  (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' (vector of 2 'int' values) to 'S' is not allowed}}
+  (void)(S)v2si; // expected-error {{no matching conversion for C-style cast from '__v2si' (vector of 2 'int' values) to 'S'}}
+  (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'S' to '__v2si' (vector of 2 'int' values) is not allowed}}
+  (void)(__v2si)s; // expected-error {{cannot convert 'S' to '__v2si' (vector of 2 'int' values) without a conversion operator}}
   
-  (void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' to scalar 'unsigned char' of different size}}
-  (void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' to scalar 'unsigned char' of different size}}
-  (void)reinterpret_cast<__v2si>(c); // expected-error {{reinterpret_cast from scalar 'unsigned char' to vector '__v2si' of different size}}
+  (void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' (vector of 2 'int' values) to scalar 'unsigned char' of different size}}
+  (void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' (vector of 2 'int' values) to scalar 'unsigned char' of different size}}
+  (void)reinterpret_cast<__v2si>(c); // expected-error {{reinterpret_cast from scalar 'unsigned char' to vector '__v2si' (vector of 2 'int' values) of different size}}
 
-  (void)reinterpret_cast<__v8hi>(v4hi); // expected-error {{reinterpret_cast from vector '__v4hi' to vector '__v8hi' of different size}}
-  (void)(__v8hi)v4hi; // expected-error {{C-style cast from vector '__v4hi' to vector '__v8hi' of different size}}
-  (void)reinterpret_cast<__v4hi>(v8hi); // expected-error {{reinterpret_cast from vector '__v8hi' to vector '__v4hi' of different size}}
-  (void)(__v4hi)v8hi; // expected-error {{C-style cast from vector '__v8hi' to vector '__v4hi' of different size}}
+  (void)reinterpret_cast<__v8hi>(v4hi); // expected-error {{reinterpret_cast from vector '__v4hi' (vector of 4 'short' values) to vector '__v8hi' (vector of 8 'short' values) of different size}}
+  (void)(__v8hi)v4hi; // expected-error {{C-style cast from vector '__v4hi' (vector of 4 'short' values) to vector '__v8hi' (vector of 8 'short' values) of different size}}
+  (void)reinterpret_cast<__v4hi>(v8hi); // expected-error {{reinterpret_cast from vector '__v8hi' (vector of 8 'short' values) to vector '__v4hi' (vector of 4 'short' values) of different size}}
+  (void)(__v4hi)v8hi; // expected-error {{C-style cast from vector '__v8hi' (vector of 8 'short' values) to vector '__v4hi' (vector of 4 'short' values) of different size}}
 }
 
 struct testvec {
index 7957c23e3e24056f0c691928673b46fee4127774..bcd7fedb4df2cc923775f1adcc368dd12cc4de8d 100644 (file)
@@ -24,8 +24,8 @@ void f1_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
   f1(ll16e); // expected-error{{call to 'f1' is ambiguous}}
 }
 
-void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' to 'char16_e' for 1st argument}} \
-       // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' for 1st argument}}
+void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) for 1st argument}} \
+       // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' (vector of 16 'char' values) for 1st argument}}
 
 void f2_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
   f2(c16);
@@ -85,7 +85,7 @@ void casts(longlong16 ll16, longlong16_e ll16e) {
   (void)static_cast<longlong16>(ll16);
   (void)static_cast<longlong16_e>(ll16);
   (void)static_cast<char16>(ll16e);
-  (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' to 'char16_e' is not allowed}}
+  (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) is not allowed}}
   (void)static_cast<longlong16>(ll16e);
   (void)static_cast<longlong16_e>(ll16e);
 
@@ -194,11 +194,11 @@ typedef float fltx4 __attribute__((__vector_size__(16)));
 typedef double dblx2 __attribute__((__vector_size__(16)));
 typedef double dblx4 __attribute__((__vector_size__(32)));
 
-void accept_fltx2(fltx2); // expected-note{{candidate function not viable: no known conversion from 'double' to 'fltx2' for 1st argument}}
+void accept_fltx2(fltx2); // expected-note{{candidate function not viable: no known conversion from 'double' to 'fltx2' (vector of 2 'float' values) for 1st argument}}
 void accept_fltx4(fltx4);
 void accept_dblx2(dblx2);
 void accept_dblx4(dblx4);
-void accept_bool(bool); // expected-note{{candidate function not viable: no known conversion from 'fltx2' to 'bool' for 1st argument}}
+void accept_bool(bool); // expected-note{{candidate function not viable: no known conversion from 'fltx2' (vector of 2 'float' values) to 'bool' for 1st argument}}
 
 void test(fltx2 fltx2_val, fltx4 fltx4_val, dblx2 dblx2_val, dblx4 dblx4_val) {
   // Exact matches
index e6ef5a492f8c03606ec3e04fca2d988609e6e244..90cec26a605a4ede20b2d1823ece1fe4c6c63cba 100644 (file)
@@ -7,8 +7,8 @@ typedef unsigned uint3 __attribute((ext_vector_type(3)));
 
 void vector_conv_invalid() {
   uint4 u = (uint4)(1);
-  int4 i = u; // expected-error{{initializing 'int4' with an expression of incompatible type 'uint4'}}
-  int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector type 'int4' and 'uint4'}}
+  int4 i = u; // expected-error{{initializing 'int4' (vector of 4 'int' values) with an expression of incompatible type 'uint4' (vector of 4 'unsigned int' values)}}
+  int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector type 'int4' (vector of 4 'int' values) and 'uint4' (vector of 4 'unsigned int' values)}}
 
-  uint3 u4 = (uint3)u; // expected-error{{invalid conversion between ext-vector type 'uint3' and 'uint4'}}
+  uint3 u4 = (uint3)u; // expected-error{{invalid conversion between ext-vector type 'uint3' (vector of 3 'unsigned int' values) and 'uint4' (vector of 4 'unsigned int' values)}}
 }