Bug when overload function in multiple modules?
Lemonfiend via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 27 07:38:23 PDT 2014
I get:
src\app.d(19): Error: None of the overloads of 'foo' are callable
using argument types (C3), candidates are:
src\app.d(28): main.foo(C1 c)
src\app.d(38): main.foo(C2 c)
It does work when I explicitly import c3.foo.
--- file app.d
module app;
import std.stdio;
import c3;
//import c3:foo; //uncomment this and it works
void main()
{
C1 c1 = new C1();
c1.foo();
writeln(c1.i);
C2 c2 = new C2();
c2.foo();
writeln(c2.i);
C3 c3 = new C3();
c3.foo();
writeln(c3.i);
}
class C1
{
int i;
}
void foo(C1 c)
{
c.i = 1;
}
class C2
{
int i;
}
void foo(C2 c)
{
c.i = 2;
}
--- file c3.d
module c3;
class C3
{
int i;
}
void foo(C3 c)
{
c.i = 3;
}
More information about the Digitalmars-d-learn
mailing list