This is the mail archive of the gcc-bugs@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]

[Bug c++/49329] Static method with std::string parameter gets messed up with non-static method with bool parameter


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49329

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-09 11:48:40 UTC ---
(In reply to comment #3)
> I wasn't aware that the pointer-to-bool conversion is considered by gcc to be
> better than a char*-to-std::string conversion.

A standard conversion sequence (i.e. one built-in to the language) is better
than a user-defined conversion sequence (i.e. one using class constructors or
conversion operators)

The C++ standard defines those rules, not gcc.

> I also thought, that the first thing the compiler would do, is to
> rule out any non-static methods when a static method is inquired;
> but apparently I was wrong.

C++ has no concept of "when a static method is inquired" - you call a function
by name, so it is looked up by name, then overload resolution selects which
function is being called. xx::cc refers to the name cc in the scope xx, it
doesn't refer only to a static function.


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