https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94061
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> --- (In reply to Patrick Palka from comment #6) > It seems reasonable for this to work but there might be a defect, or at > least lack of clarity, in the standard in this situation. > > http://eel.is/c++draft/class.spaceship#3 specifies how a defaulted <=> is > defined, in terms of <=> comparisons of corresponding subobjects. But it's > not clear how each of these <=> comparisons is written. If they're always > written like operator expressions, e.g. x_i <=> y_i then if x_i / y_i are > base class subobjects that have a protected <=>, then such a definition > would indeed be ill-formed due to the protected access: > https://godbolt.org/z/5h4ednq9 The <=> comparison would need to be written > A::operator<=>(b) as mentioned in comment #2 in order for the definition to > be valid IIUC? Oops, the full CE link is https://godbolt.org/z/5h4ednq9E