* typeck.c (build_binary_op): Same.
* testsuite/g++.dg/conversion/simd3.C: New.
From-SVN: r100977
+2005-06-15 Aldy Hernandez <aldyh@redhat.com>
+
+ * typeck.c (build_binary_op): Same.
+ * testsuite/g++.dg/conversion/simd3.C: New.
+
2005-06-15 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20678
/* Vector arithmetic is only allowed when both sides are vectors. */
if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
{
- if (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1)))
- error ("can't convert between vector values of different size");
+ if (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1))
+ || !same_scalar_type_ignoring_signedness (TREE_TYPE (type0),
+ TREE_TYPE (type1)))
+ {
+ binary_op_error (code);
+ return error_mark_node;
+ }
arithmetic_types_p = 1;
}
}
--- /dev/null
+/* { dg-do compile } */
+
+typedef int myint;
+
+float __attribute__((vector_size(16))) b;
+int __attribute__((vector_size(16))) d;
+myint __attribute__((vector_size(16))) d2;
+unsigned int __attribute__((vector_size(16))) e;
+
+void foo()
+{
+ b + d; /* { dg-error "invalid operands to binary" } */
+ d += e;
+ d2 += d;
+}