PR c++/92496 - ICE with <=> and no #include <compare>.

* typeck.c (cp_build_binary_op): Handle error from spaceship_type.

From-SVN: r279331
This commit is contained in:
Jason Merrill 2019-12-13 00:05:51 -05:00 committed by Jason Merrill
parent 0fec7ca198
commit a1af2dd9c3
3 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2019-12-12 Jason Merrill <jason@redhat.com>
PR c++/92496 - ICE with <=> and no #include <compare>.
* typeck.c (cp_build_binary_op): Handle error from spaceship_type.
2019-12-11 David Malcolm <dmalcolm@redhat.com>
* cxx-pretty-print.c (cxx_pretty_printer::clone): New vfunc

View file

@ -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)
{

View file

@ -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;