This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 120b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2026-07-26


3207. Deduced return type of a deleted three-way comparison operator function

Section: 11.10.3  [class.spaceship]     Status: tentatively ready     Submitter: Arthur O'Dwyer     Date: 2026-06-29

Consider:

  struct A { friend int operator<=>(A,A); };
  struct B { A a; friend auto operator<=>(const B&) const = default; };
  using Q = [: return_type_of(^^B::operator<=>) :];

What is the type Q?

Traditionally, CWG had the viewpoint that querying properties of deleted functions (e.g. triviality) should be impossible or ill-formed. Note that reflection prohibits querying undeduced return types (21.4.7 [meta.reflection.queries] paragraph 1), so leaving undeduced the return type of deleted functions would fix the issue.

Proposed resolution (no objections during CWG reflector review started 2026-07-13):

Change in 11.10.3 [class.spaceship] bullet 2.1 as follows:

Let R be the declared return type of a defaulted three-way comparison operator function, and let xi be the elements of the expanded list of subobjects for an object x of type C.