I'm not sure what semantics we might eventually want for vector <=>, but let's give a sorry for now.
Tested x86_64-pc-linux-gnu, applying to trunk. --- gcc/cp/typeck.c | 7 +++++++ gcc/testsuite/g++.dg/cpp2a/spaceship-vec1.C | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/spaceship-vec1.C diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 124d16a31fb..ff603f3d8d9 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 00000000000..83547691118 --- /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" } +} base-commit: f15dc29a9734e360497f5bb40be6b25dcbc11645 -- 2.18.1