This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: compile or not compile
On Jul 2, 2004, llewelly@xmission.com wrote:
> Karol Szkudlarek <karol@mikronika.com.pl> writes:
>> typedef int my_int;
>> class ALibraryClass { public: int foo(const my_int&) { return 0; }
>> int foo(const bool&) { return 0; } };
>> class BClientClass { public: enum Items { item1=1000, item2=2000 };
>> void test() { ALibraryClass a; a.foo(BClientClass::item1);
> This should select A::foo(const my_int&) unambigously; enum to int is
> a promotion (see 4.5) while enum to bool is a conversion (4.12)
> and a promotion is a better match than conversion, (13.3.3.2/4).
But there's reference binding requiring conversion, so both are
user-defined conversions [over.ics.ref]/1, and none of them is better
than the other, because the tie-breaker is only the second conversion
sequence [over.ics.rank]/3, that is an exact match in both cases.
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}