This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Casting Overloaded Function Pointer Problem...
- To: "Don Mies" <dmies at bluekite dot com>, <gcc at gcc dot gnu dot org>
- Subject: RE: Casting Overloaded Function Pointer Problem...
- From: "Tom Zagotta" <tom at zagotta dot cncdsl dot com>
- Date: Tue, 12 Sep 2000 17:25:29 -0400
Hi Don,
>>If I compile the above with the Sun CC compiler, I get no complaints
>>or warnings. When I compile it with g++ (gcc version 2.95.2 19991024
>>(release)) I get the following error messages:
Your code is essentially asking GCC to convert the pointer to the member
function into a p-to-m-f of the base class. If I'm interpreting this
correctly, according to the C++ Standard, section 13.4, this is not allowed:
[Note: there are no standard conversions (clause 4) of one
pointer-to-function type into another. In particular, even if B is a public
base of D, we have
D* f();
B* (*p1)() = &f; // error
void g(D*);
void (*p2)(B*) = &g; // error
-end note]
Therefore, I think GCC may be right in complaining about this code.
Regards,
Tom Zagotta