https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94061

--- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Hmm, I'm not sure CWG 2568 makes this example well-formed?  We already do
access checks in the context of the synthesized definition, the problem is that
the synthesized definition (as per comment #2) looks like

  auto operator <=> (const B& b) const {
    return static_cast<const A&>(*this) <=> static_cast<const A&>(b);
  }

which is using A's operator<=> through an object of type A, not through an
object of type B, so the protected access don't apply.  IIUC we'd need to
change the synthesis rules when considering a base subobject in order for the
synthesis to be valid.

The example in the CWG issue is also rejected if we go on to use the
synthesized ==, so the P/R seems mainly editorial?

Reply via email to