25.12.2023 05:19, Edward Catmur пишет:

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).

It seems to work; am I missing something? https://godbolt.org/z/3c5fjnqo4

`std::is_convertible_v<const U&, secret_base<T>>` and `std::is_convertible_v<const U&, optional<T>>` are not equivalent. You could have arbitrary constraints on `A::operator T` that permit conversions to one and not the other.