On Sat, 9 Dec 2023 at 01:13, Egor via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
07.12.2023 11:15, Egor пишет:
After thinking about it, I'm not sure this is even implementable in the
first place. This constraint would have to be self-referential, and I
think those are illegal.
It's quite easy, actually; all you have to do is test for convertibility to an arbitrary hypothetical unambiguous public base class of the class being constructed. This should be implementable without affecting ABI, I think.
This won't always work. If the conversion operator is templated,
it will receive the base class type, not the derived type, and the
behavior for the two can be different (one of them can be rejected
by SFINAE but not the other, etc).