UFCS and overloading

Szymon Gatner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 6 09:23:29 PDT 2015


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.


More information about the Digitalmars-d-learn mailing list