diff mbox

C++ PATCH for c++/58845 (ICE with vector &&)

Message ID 5311E8AB.8010309@redhat.com
State New
Headers show

Commit Message

Jason Merrill March 1, 2014, 2:03 p.m. UTC
There is some uncertainty in the PR discussion about what semantics 
vector && should have, so this patch just avoids the ICE for now.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.8.
diff mbox

Patch

commit cbf13b08495010d24a784170f76684e5109bd92b
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Feb 28 23:56:22 2014 -0500

    	PR c++/58845
    	* typeck.c (cp_build_binary_op): Sorry on vector&&vector.

diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 1e14b63..29f9e9d 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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
index 0000000..288e13c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector27.C
@@ -0,0 +1,7 @@ 
+// PR c++/58845
+
+void foo()
+{
+  int v __attribute__((vector_size(8)));
+  v = v || v;			// { dg-bogus "" "" { xfail *-*-* } }
+}