This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with overloaded function selection


Hi Andrey,

The conversions

>     operator double() {return 0L;};
>     operator int() { return 0; };

 are equally poor, as one level of user defined
conversions and one level of default conversions
are required to match

> void test(char){};

 Having both conversions causes neither to be
considered, which means that

>     operator A() { return A();};

is the only choice.

 Removing either of
>     operator double() {return 0L;};
>     operator int() { return 0; };

 makes the call
>   test(b);

 ambiguous, since
> void test(char){};

is a candidate through one level of user defined
conversions and one level of default conversions
and

> void test(A){};
is a candidate through one level of user defined
conversions.

 I guess, one will have to look in the specs to
see, who is right in this matter. My gut feeling
is, that it gcc is right. Conversions and function
overloading seem pretty othogonal to me. Why should
two conversions be worse than one conversion in matching
an overloaded function??

Yours sincerely,

Bjorn


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]