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

--- Comment #2 from Sam Yates <halfflat at gmail dot com> ---
Thank you for the prompt assessment! A standards proposal or DR does seem like
the more robust solution for the longer term.

In the interim, for my application, I am boxing-up the std::any in another
struct [1] and unboxing as required; this breaks the chain of implicit
conversions. Ultimately this code will need to be buildable in C++20 and I will
use a back-ported std::expected workalike which can implement your proposed
restriction on operator==.


[1] This, basically:
template <typename T>
struct box {
    template <typename... Ts>
    explicit box(Ts&&... ts): value(std::forward<Ts>(ts)...) {}
    T value;
};

Reply via email to