Normal error-recovery.
Tested x86_64-pc-linux-gnu, applying to trunk.
* typeck.c (cp_build_binary_op): Handle error from spaceship_type.
---
gcc/cp/typeck.c | 6 +++++-
gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C | 12 ++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index d0f739895c9..d3814585e3f 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5418,7 +5418,11 @@ cp_build_binary_op (const op_location_t &location,
result_type = NULL_TREE;
if (result_type)
- build_type = spaceship_type (result_type, complain);
+ {
+ build_type = spaceship_type (result_type, complain);
+ if (build_type == error_mark_node)
+ return error_mark_node;
+ }
if (result_type && arithmetic_types_p)
{
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C
b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C
new file mode 100644
index 00000000000..45ce4ee047a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C
@@ -0,0 +1,12 @@
+// PR c++/92496
+// { dg-do compile { target c++2a } }
+
+template<auto V>
+struct A {};
+
+struct B {
+ constexpr auto operator<=>(const B&) const = default; // { dg-error "" }
+ int value;
+};
+
+A<B{}> t;
base-commit: 3dbaca45883c354c9d4e9542d5c95f054997f844
--
2.18.1