[clang] [Clang] Diagnose defaulted assignment operator with incompatible object parameter (PR #70176)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 05:13:50 PDT 2023


AaronBallman wrote:

> > > Per https://eel.is/c++draft/dcl.fct.def.default#2.2, the explicit object parameter of a defaulted special member function must be of the same type as the one of an equivalent implicitly defaulted function, ignoring references.
> > 
> > 
> > I could use an explanation as to how they must be the same type when 2.2 says "...may be an explicit object member function whose explicit object parameter is of (possibly different) type “reference to C”, in which case..."
> 
> That wording is terrible, but it's hard to phrase it better. The type may be different but it is always a reference to `C` where C is the same type.
> 
> Ie it can be either `C&` or `C&&`. this is consistent with the fact that we allow ref-qualified functions. There is some context here https://lists.isocpp.org/core/2023/07/14608.php
> 
> I had a chat with core on mattermost and there is agreement that the wording could be made clearer editorially.

Thank you for the explanation!

https://github.com/llvm/llvm-project/pull/70176


More information about the cfe-commits mailing list