On 4/6/15 12:23 PM, Szymon Gatner wrote:
Hi,

I am surprised that this doesn't work:

class Foo
{
   void bar(string) {}
}

void bar(Foo foo, int i)
{
}

auto foo = new Foo();
foo.bar(123); // <=== error

causing compilation error:

main.d(24): Error: function main.Foo.bar (string _param_0) is not
callable using argument types (int)

does UFCS now work with method overloading? I know it is not a syntax
error because changing the name of int version of bar to bar2 and
calling foo.bar2(123) works fine.

You can't do this. UFCS cannot add overloads, it can only add whole overload sets (if not already present).

-Steve

Reply via email to