From: Jason Merrill Date: Fri, 13 Dec 2019 05:05:51 +0000 (-0500) Subject: PR c++/92496 - ICE with <=> and no #include . X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1af2dd9c3a5f6b4885db739f6fc3d80ed80007a;p=gcc.git PR c++/92496 - ICE with <=> and no #include . * typeck.c (cp_build_binary_op): Handle error from spaceship_type. From-SVN: r279331 --- 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;