This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49329] Static method with std::string parameter gets messed up with non-static method with bool parameter
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 9 Jun 2011 11:48:41 +0000
- Subject: [Bug c++/49329] Static method with std::string parameter gets messed up with non-static method with bool parameter
- Auto-submitted: auto-generated
- References: <bug-49329-4@http.gcc.gnu.org/bugzilla/>
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.