Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger 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 |
c++ - enum to int conversion (bug?)
I don't know whether this is a bug or not, Comeau compiles it without a problem. #include <stdio.h> class Bug3 { public : enum Type { Type_ONE = 0x0001, Type_TWO = 0x0002 }; public : Bug3 () {} bool Set ( bool _one, Type _two = Type_ONE ) { printf ( "Set ( bool _one = %b )\n", _one ); return ( true ); } bool Set ( int _one = 0, Type _two = Type_ONE ) { printf ( "Set ( int _one = %d )\n", _one ); return ( true ); } }; int main ( int argc, char *argv [] ) { Bug3 test; test.Set ( true , Bug3 :: Type_ONE ); // this works test.Set ( false , Bug3 :: Type_ONE ); // this works test.Set ( 0 , Bug3 :: Type_TWO ); // this works test.Set ( 1 , Bug3 :: Type_TWO ); // this works test.Set ( Bug3 :: Type_ONE, Bug3 :: Type_TWO ); // this does NOT work test.Set ( Bug3 :: Type_TWO, Bug3 :: Type_TWO ); // this does NOT work return ( 0 ); } Apr 02 2003
Yep, this is a similar problem as the one I posted before about the int <-> bool conversion problem. "Arjan" <Arjan_member pathlink.com> wrote in message news:b6ecdg$ulb$1 digitaldaemon.com...I don't know whether this is a bug or not, Comeau compiles it without a Apr 02 2003
|