]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58845 (Operator || and && broken for vectors)
authorJason Merrill <jason@redhat.com>
Sat, 1 Mar 2014 14:14:25 +0000 (09:14 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 1 Mar 2014 14:14:25 +0000 (09:14 -0500)
PR c++/58845
* typeck.c (cp_build_binary_op): Sorry on vector&&vector.

From-SVN: r208243

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/g++.dg/ext/vector27.C [new file with mode: 0644]

index 9a13f49ef13f5aa65bd251b61cb00666de2bf1f7..939f5e18f02bd742777214fe114b5c0bee35ffc7 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-28  Jason Merrill  <jason@redhat.com>
+
+       PR c++/58845
+       * typeck.c (cp_build_binary_op): Sorry on vector&&vector.
+
 2014-02-28  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/58610
index 1e14b638e6c39a6de90db62b6d3ecfba3a09bb31..29f9e9daaee9022be979efe156de78da5526a55b 100644 (file)
@@ -4177,6 +4177,11 @@ cp_build_binary_op (location_t location,
     case TRUTH_ORIF_EXPR:
     case TRUTH_AND_EXPR:
     case TRUTH_OR_EXPR:
+      if (VECTOR_TYPE_P (type0) || VECTOR_TYPE_P (type1))
+       {
+         sorry ("logical operation on vector type");
+         return error_mark_node;
+       }
       result_type = boolean_type_node;
       break;
 
diff --git a/gcc/testsuite/g++.dg/ext/vector27.C b/gcc/testsuite/g++.dg/ext/vector27.C
new file mode 100644 (file)
index 0000000..288e13c
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/58845
+
+void foo()
+{
+  int v __attribute__((vector_size(8)));
+  v = v || v;                  // { dg-bogus "" "" { xfail *-*-* } }
+}