aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-11-11 23:53:59 -0500
committerJason Merrill <jason@gcc.gnu.org>2019-11-11 23:53:59 -0500
commit6e9a85d5052607c8ed31940ce2794323df9463cc (patch)
tree998f4e7db135f4a17d444d63c8cb418fd12ca293 /gcc
parent2965eaa89d843a1c260291376020d71127c05741 (diff)
downloadgcc-6e9a85d5052607c8ed31940ce2794323df9463cc.zip
gcc-6e9a85d5052607c8ed31940ce2794323df9463cc.tar.gz
gcc-6e9a85d5052607c8ed31940ce2794323df9463cc.tar.bz2
* typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
From-SVN: r278077
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c7
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-vec1.C11
3 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a5bc9d4..7e5e446 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2019-11-11 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
+
2019-11-11 Jakub Jelinek <jakub@redhat.com>
PR c++/92447
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 124d16a..ff603f3 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5224,6 +5224,13 @@ cp_build_binary_op (const op_location_t &location,
"types %qT and %qT", type0, type1);
}
+ if (resultcode == SPACESHIP_EXPR)
+ {
+ if (complain & tf_error)
+ sorry_at (location, "three-way comparison of vectors");
+ return error_mark_node;
+ }
+
/* Always construct signed integer vector type. */
intt = c_common_type_for_size
(GET_MODE_BITSIZE (SCALAR_TYPE_MODE (TREE_TYPE (type0))), 0);
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-vec1.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-vec1.C
new file mode 100644
index 0000000..8354769
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-vec1.C
@@ -0,0 +1,11 @@
+// { dg-do compile { target c++2a } }
+
+#include <compare>
+
+#define vector __attribute__((vector_size(4*sizeof(int)) ))
+
+int main()
+{
+ vector int a, b;
+ a <=> b; // { dg-message "three-way comparison of vector" }
+}