Scenario: a class belongs to a library, and I don't want to change it. But for convenience I want to call methods with different arguments.
Simple example:
class C
{
void foo(int i) {}
}
void foo(C c, float f)
{
c.foo(cast(int)lrint(f));
}
Sadly the following code doesn't compile:
C c;
c.foo(0f);
Output:
Error: function C.foo (int i) is not callable using argument types (float)
It may be part of the definition of UFCS that the compiler only searches for global UFCSized functions when no such methods exist. If it's the case, it'd be great to extend this definition to searching for global functions only if no methods with the given arguments exist.
Comment #1 by b2.temp — 2016-10-19T21:09:07Z
*** This issue has been marked as a duplicate of issue 15830 ***