This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16334] New: No warning about use of overloading extension
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jul 2004 19:10:40 -0000
- Subject: [Bug c++/16334] New: No warning about use of overloading extension
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
G++ has an extension to the overloading rules of C++. In particular, when ISO
C++ would consider a call ambiguous, G++ does an additional check. It finds the
function whose *worst* conversion is least bad; if there is a unique such
function, that one is used. (The code that does this is at the end of "joust".)
Jason indicated that this extension should not be removed due to backwards
compatibility issues, but that we should always be issuing a pedwarn in such cases.
However, if the winning candidate under the extension turns out to be a built-in
operator, no warning is issued.
Jason agreed to make sure that a warning is issued even in that case. Perhaps
this message will also induce him into documenting this alleged feature in the
extensions portion of the manual. :-)
A test case follows.
extern "C" int printf(const char *, ...);
class MSBinaryVector {
public:
MSBinaryVector (unsigned int, unsigned char =0)
{
}
};
MSBinaryVector operator& (const unsigned char, const MSBinaryVector
&){
printf("not built-in\n");
return 0;
}
typedef unsigned char __iostate;
enum io_state { eofbit };
int main() {
__iostate state;
return state & eofbit;
}
--
Summary: No warning about use of overloading extension
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: jason at redhat dot com
ReportedBy: mmitchel at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16334