Re: compile or not compile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexandre Oliva wrote:

On Jul  2, 2004, llewelly@xxxxxxxxxxxx wrote:



Karol Szkudlarek <karol@xxxxxxxxxxxxxxxx> 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.



OK. But why this compiles without error with gcc (3.3) on one platform
and one another (gcc 3.3) it doesn't?

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux