]> 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 18:44:25 +0000 (13:44 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 1 Mar 2014 18:44:25 +0000 (13:44 -0500)
PR c++/58845
* typeck.c (cp_build_binary_op): Sorry on vector&&vector.

From-SVN: r208246

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

index 329389512bd4393ee23e46002b2d71a46d5ba5d7..7359cb7d8dc0061bef652f6f30e97c450c11f274 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-26  Jason Merrill  <jason@redhat.com>
 
        PR c++/60182
index 299e1f45352ea3f8b689150bc219c8f7b406376e..b8e862cb3c73df263d34b30e4608de91d88b754f 100644 (file)
@@ -4103,6 +4103,11 @@ cp_build_binary_op (location_t location,
     case TRUTH_ORIF_EXPR:
     case TRUTH_AND_EXPR:
     case TRUTH_OR_EXPR:
+      if (TREE_CODE (type0) == VECTOR_TYPE || TREE_CODE (type1) == VECTOR_TYPE)
+       {
+         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 *-*-* } }
+}