https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94061
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
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?