This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/477: problem casting member function pointer
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/477: problem casting member function pointer
- From: sondheim at knxmail dot com
- Date: 17 Aug 2000 02:44:24 -0000
- Cc: loren at reflexive dot net
- Reply-To: sondheim at knxmail dot com
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, jason at gcc dot gnu dot org, loren at reflexive dot net
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, sondheim@knxmail.com
>Number: 477
>Category: c++
>Synopsis: problem casting member function pointer
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 16 19:46:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: sondheim@knxmail.com <Loren Osborn>
>Release: gcc 2.95.2
>Organization:
>Environment:
Linux/Mandrake 7.0
>Description:
We are having trouble with gcc with a feature that we
aren't sure if it is ANSI C++ compliant. As such, we
are unsure if this is a bug in our code, or yours...
We *DO* have a workaround (illustrated below), but
converting our code-base to use the work around would
be a significant task.
So my questions are as follows:
1) Are both of the following ANSI C++ compliant?
2) Should gcc recognize both of these cases as equivilant?
3) Do versions newer than 2.95.2 support this?
All help is very greatly appreciated.
Thank you,
-Loren
>How-To-Repeat:
class Foo {
};
class Bar: public Foo {
public:
int my_func(int);
int func(int);
};
int Bar::func(int num) {
return num;
}
typedef int (Foo::*func_ptr)(int);
int use_func( Foo *my_foo, func_ptr func_arg, int val ) {
return (my_foo->*func_arg)(val);
}
int Bar::my_func ( int my_val ) {
#ifdef WORK
return use_func( this, (func_ptr) &Bar::func, my_val );
#else
return use_func( this, (func_ptr) func, my_val );
#endif
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: