April 01, 2003 Is this an other compiler (8.33) bug? calling a member functies with the default parameter. | ||||
---|---|---|---|---|
| ||||
> #include <stdio.h>
>
>
>
> class Test2
> {
> public :
> typedef unsigned short Test2_t;
>
> enum Type
> {
> ONE,
> TWO,
> THREE,
> };
>
> static const char *TypeStr [ 4 ];
>
> public :
> Test2 () {}
>
> void Set ( Test2_t _one, Test2_t _two = 0 )
> {
> printf ( "Set ( Test2_t _one = %d, Test2_t _two = %d )\n", _one, _two );
> }
>
> void Set ( Test2_t _zero, Type _type, int _i = 9999, Test2_t _one = 0, Test2_t _two = 0 )
> {
> printf ( "Set ( Test2_t _zero = %d, Type _type = %s, int _i = %d, Test2_t _one = %d, Test2_t _two = %d )", _zero, TypeStr [ _type ], _i, _one, _two );
> }
> };
>
>
>
> const char *Test2 :: TypeStr [ 4 ] =
> {
> "ONE",
> "TWO",
> "THREE",
> 0,
> };
>
>
>
> int main ( int argc, char *argv [] )
> {
> Test2 :: Test2_t var = 0;
> Test2 test;
>
> test.Set ( var, 0 ); // this doen't work
> test.Set ( var, 1 ); // this does
> test.Set ( var, Test2 :: ONE, 0, 0 );
>
> return ( 0 );
> }
P:\APK\DMC>s:\bin\dmc bug2.cpp
test.Set ( var, 0 ); // this doen't work
^
bug2.cpp(50) : Error: ambiguous reference to symbol
Had: Test2::Set(unsigned short ,unsigned short )
and: Test2::Set(unsigned short ,enum Test2::Type,int ,unsigned short
,unsigned short )
--- errorlevel 1
|
Copyright © 1999-2021 by the D Language Foundation