|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.learn - Enum/typedef and overloading
Tested in dmd 1.007, the two toString definitions conflicts when they
are in main, not when they are out of the main function.
Do you think that's a bug or not?
import std.stdio;
int main(char[][] args)
{
enum Foo { A , B };
enum Foo2 { C , D };
char[] toString(Foo x)
{
return "1";
}
char[] toString(Foo2 x)
{
return "2";
}
Foo s = Foo.A;
writefln("s is %s, with name %s\n", s, toString(s));
Foo2 o = Foo2.C;
writefln("o is %s, with name %s\n", o, toString(o));
return 0;
}
regards,
renoX
Feb 24 2007
|