diff options
author | Jason Merrill <jason@redhat.com> | 2019-12-13 00:05:51 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-12-13 00:05:51 -0500 |
commit | a1af2dd9c3a5f6b4885db739f6fc3d80ed80007a (patch) | |
tree | 1ba6cbab3fbf39561b0736e3375da640835ccfc3 | |
parent | 0fec7ca1980a23a212790dee04fcf1f7e12d0417 (diff) | |
download | gcc-a1af2dd9c3a5f6b4885db739f6fc3d80ed80007a.zip gcc-a1af2dd9c3a5f6b4885db739f6fc3d80ed80007a.tar.gz gcc-a1af2dd9c3a5f6b4885db739f6fc3d80ed80007a.tar.bz2 |
PR c++/92496 - ICE with <=> and no #include <compare>.
* typeck.c (cp_build_binary_op): Handle error from spaceship_type.
From-SVN: r279331
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C | 12 |
3 files changed, 22 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 202bb6c..dd7da14 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d0f7398..d381458 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 0000000..45ce4ee --- /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; |