Say I have a class STest and I want it to be able to implicitly cast to char const* but not bool.
struct STest {
operator char const*() const& { return "abc"; }
operator bool() const& = delete;
};
void bar(bool) {}
void foo(bool) {}
void foo(char const*) {}
This implementation works as expected (error) when calling bar(STest{}). But it doesn't work for foo(STest{}) because deleted function is also considered in overload resolution and it complains ambiguity. Is there a way to workaround this which means bar(STest{}) raises an error and foo(STest{}) calls foo(char const*)?