From abb839ecacf4034ccb8376e4ab96e522287ff126 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 1 Mar 2014 09:14:25 -0500 Subject: [PATCH] re PR c++/58845 (Operator || and && broken for vectors) PR c++/58845 * typeck.c (cp_build_binary_op): Sorry on vector&&vector. From-SVN: r208243 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck.c | 5 +++++ gcc/testsuite/g++.dg/ext/vector27.C | 7 +++++++ 3 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/vector27.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9a13f49ef13f..939f5e18f02b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-02-28 Jason Merrill + + PR c++/58845 + * typeck.c (cp_build_binary_op): Sorry on vector&&vector. + 2014-02-28 Paolo Carlini PR c++/58610 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 1e14b638e6c3..29f9e9daaee9 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 000000000000..288e13c558d4 --- /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 *-*-* } } +} -- 2.47.2