]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/92496 - ICE with <=> and no #include <compare>.
authorJason Merrill <jason@redhat.com>
Fri, 13 Dec 2019 05:05:51 +0000 (00:05 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 13 Dec 2019 05:05:51 +0000 (00:05 -0500)
* typeck.c (cp_build_binary_op): Handle error from spaceship_type.

From-SVN: r279331

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C [new file with mode: 0644]

index 202bb6cd0b1d721831a9e3415e3e09758ed7291b..dd7da14ae3fec3269f58cc1777c67887676772b2 100644 (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
index d0f739895c941476b5e1f8fddd52c5d2624a608a..d3814585e3ffa1a3b6bc5f010de2c6541d510917 100644 (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)
        {
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 (file)
index 0000000..45ce4ee
--- /dev/null
@@ -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;