D1: Overloading across modules

Daniel Keep daniel.keep.lists at gmail.com
Tue Mar 23 03:42:43 PDT 2010



Nick Sabalausky wrote:
> In D1, is there any reason I should be getting an error on this?:
>
> // module A:
> enum FooA { fooA };
> void bar(FooA x) {}
> 
> // module B:
> import A;
> enum FooB { fooB };

alias A.bar bar;

> void bar(FooB x) {}
> 
> bar(FooB.fooB); // Error: A.bar conflicts with B.bar
> 
> Is overloading across modules not allowed? Is overloading on two different 
> enum types not allowed? Is it a DMD bug? Or does this all work fine and I 
> probably just have some other problem elsewhere? 

The compiler assumes that, unless you specifically tell it otherwise,
symbols pulled in from another module conflict with local ones.

This might also work: import A : bar;


More information about the Digitalmars-d-learn mailing list