c++/2110: compile error in function pointer cast (regression from 2.95)

dmuell@gmx.net dmuell@gmx.net
Mon Feb 26 17:16:00 GMT 2001


>Number:         2110
>Category:       c++
>Synopsis:       compile error due to method function pointer cast
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 26 17:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dirk Mueller
>Release:        3.0 20010226 (prerelease)
>Organization:
>Environment:
Linux 2.4.2 
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --enable-threads --enable-shared --enable-languages=c,c++
>Description:

try to compile this code: 

=== Cut ===
class fooObject {};
typedef void (fooObject::*Func)();
class foobar : public fooObject {
    void add(Func fncHandler);
    void somefunc();
    void init() { add(static_cast<Func>(&(foobar::somefunc))); }
};
=== Cut ===

The code might look a bit stupid, its a minimum testcase. the actual code
is different. 

command line: 
#g++ -c foobar.cpp

error message: 

invalid static_cast from type `<unknown type>' to type `void (fooObject::*)()'

Code compiles fine with any previous gcc/egcs release. Is broken
with gcc CVS for quite a while already. 

>How-To-Repeat:
read description
>Fix:
unknown. urgently needed. 
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list