C++ Logo

std-proposals

Advanced search

Re: Bringing consistency to implicit conversion by ref-qualified conversion functions

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 31 Dec 2020 00:27:59 +0200
On Thu, 31 Dec 2020 at 00:16, Hani Deek via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> I believe the compilers will accept these examples when the types in question are convertible to each other. The type int is implicitly convertible to float and vice versa, but the same is untrue for int*/float* and A/B in your examples. Jim x suggested an explanation for this behavior in this post https://lists.isocpp.org/std-discussion/2020/12/0941.php. The complexity of his explanation is one motive behind my proposal.

Ha, indeed. Convertible to each other, but not just in one direction.
See, I wondered about that too, and made B publicly inherit
A, and that made no difference for obj(). The complexity of this is
indeed mind-boggling.

Received on 2020-12-30 16:28:12