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

            Bug ID: 119674
           Summary: defaulted assignment operator with xobj syntax is an
                    xobj function instead of an iobj function
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: waffl3x at gcc dot gnu.org
  Target Milestone: ---

dcl.fct.def.default p2
An explicitly defaulted special member function F1 is allowed to differ
from the corresponding special member function F2 that would have been
implicitly declared, as follows: 
(2.2) if F2 has an implicit object parameter of type “reference to C”,
      F1 may be an explicit object member function whose explicit
      object parameter is of (possibly different) type “reference to
      C”, in which case the type of F1 would differ from the type of F2
      in that the type of F1 has an additional parameter;

I am interpreting this to mean that the declaration of the function
that is defaulted does not effect the actual function that is
generated.  I assume there is another passage somewhere that specifies
this more directly.

I'm not 100% sure if my interpretation is correct, but if it is our
current implementation is not.

```
struct S0 {
  S0& operator=(S0 const&) = default;
};
struct S1 {
  S1& operator=(this S1&, S1 const&) = default;
};

int main()
{
  // well-formed, accepted
  S0& (S0::* p0)(S0 const&) = &S0::operator=;
  // well-formed, rejected
  S1& (S1::* p1)(S1 const&) = &S1::operator=;
  // ill-formed, rejected
  S0& (* p2)(S0&, S0 const&) = &S0::operator=;
  // ill-formed, accepted
  S1& (* p3)(S1&, S1 const&) = &S1::operator=;
}
```

Reply via email to