aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C11
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2f1a2f0..5f370e6 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -14169,6 +14169,10 @@ copy_fn_p (const_tree d)
accept those as copy functions. */
return 0;
+ if (!DECL_CONSTRUCTOR_P (d)
+ && DECL_NAME (d) != assign_op_identifier)
+ return 0;
+
args = FUNCTION_FIRST_USER_PARMTYPE (d);
if (!args)
return 0;
@@ -14242,6 +14246,10 @@ move_signature_fn_p (const_tree d)
tree arg_type;
bool result = false;
+ if (!DECL_CONSTRUCTOR_P (d)
+ && DECL_NAME (d) != assign_op_identifier)
+ return 0;
+
args = FUNCTION_FIRST_USER_PARMTYPE (d);
if (!args)
return 0;
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C
new file mode 100644
index 0000000..93f5e253
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C
@@ -0,0 +1,11 @@
+// PR c++/95844
+// { dg-do compile { target c++20 } }
+
+#include <compare>
+
+struct F {
+ [[deprecated("oh no")]] std::strong_ordering operator<=>(const F&) const = default; // { dg-message "" }
+};
+void use_f(F f) {
+ void(f == f); // { dg-warning "deprecated" }
+}