From a1af2dd9c3a5f6b4885db739f6fc3d80ed80007a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 13 Dec 2019 00:05:51 -0500 Subject: [PATCH] PR c++/92496 - ICE with <=> and no #include . * typeck.c (cp_build_binary_op): Handle error from spaceship_type. From-SVN: r279331 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck.c | 6 +++++- gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C | 12 ++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 202bb6cd0b1..dd7da14ae3f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-12-12 Jason Merrill + + PR c++/92496 - ICE with <=> and no #include . + * typeck.c (cp_build_binary_op): Handle error from spaceship_type. + 2019-12-11 David Malcolm * cxx-pretty-print.c (cxx_pretty_printer::clone): New vfunc 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 +struct A {}; + +struct B { + constexpr auto operator<=>(const B&) const = default; // { dg-error "" } + int value; +}; + +A t; -- 2.30.2