Can we fix the following inconsistency in #CPlusPlus: https://compiler-explorer.com/z/qsYeTncE4? A conversion operator is sufficient to call wrapped function pointers. But it does not work for wrapped callable objects. And that's even though `wrapper` in the above example has the callable type in its associated namespaces (ADL). ADL was introduced to make operators work. I patched my #GCC to make it work and I like it.
Compiler Explorer - C++ (x86-64 gcc (trunk))
template <typename T> struct wrapper { T value; constexpr operator const T&() const { return value; } #if 0 constexpr decltype(auto) operator()(auto&&... args) { return value(args...); } #endif }; int f1(int); auto f2 = [](int x) { return f1(x); }; int test1() { return wrapper{f1}(1); } int test2() { return wrapper{f2}(1); }
Antifascista)