defaulted_late_check is for checks that need to happen after the class is
complete; we shouldn't call it sooner.
PR c++/110084
gcc/cp/ChangeLog:
* pt.cc (tsubst_function_decl): Only check a function defaulted
outside the class if the class is complete.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/spaceship-synth-neg3.C: Check error message.
* g++.dg/cpp2a/spaceship-eq16.C: New test.
(cherry picked from commit
e17a122d417fc0d606bcb3a3705b93ee81745cab)
}
determine_visibility (r);
if (DECL_DEFAULTED_OUTSIDE_CLASS_P (r)
+ && COMPLETE_TYPE_P (DECL_CONTEXT (r))
&& !processing_template_decl)
defaulted_late_check (r);
--- /dev/null
+// PR c++/110084
+// { dg-do compile { target c++20 } }
+
+template <class T>
+class BadTuple {
+ constexpr bool operator==(const BadTuple&) const;
+};
+template<class T>
+constexpr bool BadTuple<T>::operator==(const BadTuple<T>&) const = default;
+
+BadTuple<int> a;
struct A {};
struct B {
- constexpr auto operator<=>(const B&) const = default; // { dg-error "" }
+ constexpr auto operator<=>(const B&) const = default; // { dg-error "strong_ordering" }
int value;
};