On 03/23/2010 05:42 AM, Daniel Keep wrote:
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;
What about
// module A:
enum FooA{ fooA };
void bar(FooA x){}
// module B:
import A;
mixin(`
enum FooB{ fooB };
void bar(FooB x){}
`);
bar(FooB.fooB);
It doesn't seem to work the same as when enum FooB et al are normal
code. It's been giving me grief lately.