This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
G++ : pointers to overloaded function members problem
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: G++ : pointers to overloaded function members problem
- From: "Marc Mendez" <mmendez at paris dot sgi dot com>
- Date: Mon, 23 Apr 2001 12:12:15 +0200
Originator : Marc Mendez
Organisation : SGI
Synopsis : "G++ : pointers to overloaded function members problem"
Severity : serious
Priority : medium
Category : C++
Class : rejects-legal
Release : 2.96-001117p1
OS : Turbolinux Beta3/IA64
Code sample :
**************** toto.h ******************
#ifndef TOTO_H
#define TOTO_H
class toto
{
public:
toto(void) {}
~toto(void) {}
static long fonction (long);
static long fonction (long, char*);
};
#endif // TOTO_H
**************** toto.cpp ******************
#include "toto.h"
long toto::fonction (long l1)
{
return l1;
}
long toto::fonction (long l1, char* str)
{
return l1;
}
**************** main.cpp ******************
#include "toto.h"
// + correcting the bug ...
long _fonction_ (long l1)
{
return toto::fonction (l1);
}
long _fonction_ (long l1, char* str)
{
return toto::fonction (l1, str);
}
// - till there !
// guilty function
void XXXX (long (*f1)(long),
long (*f2)(long, char*))
{
}
int main (void)
{
// correct call
XXXX (_fonction_,
_fonction_);
// guilty call !!!
// XXXX (toto::fonction,
// toto::fonction);
return 0;
}
The command used to compile are simply :
$ g++ -c toto.cpp
$ g++ -c main.cpp
$ g++ -o test toto.o main.o
When uncommenting the buggy release, this message appears :
$ g++ -c main.cpp
main3.cpp: In function `int main ()':
main3.cpp:28: assuming & on overloaded member function
main3.cpp:28: assuming & on overloaded member function
$
Thanks for your work,
Marc.
Marc Mendez - Application Consulting Engineer
SGI Application Group
21, rue Albert Calmette
78350 Jouy-en-Josas - France
Tel. : 33.(0)1.34.88.80.00
eMail : mmendez@paris.sgi.com
Web : http://www.sgi.com/
###########################################################
# NB:INFORMATION IN THIS MESSAGE IS SGI CONFIDENTIAL. IT
# IS INTENDED SOLELY FOR THE PERSON(S) TO WHOM IT IS
# ADDRESSED AND MAY NOT BE COPIED, USED, DISCLOSED OR
# DISTRIBUTED TO OTHERS WITHOUT SGI CONSENT. IF YOU ARE
# NOT THE INTENDED RECIPIENT PLEASE WILL YOU NOTIFY ME BY
# EMAIL OR TELEPHONE, DELETE THE MESSAGE FROM YOUR SYSTEM
# IMMEDIATELY AND DESTROY ANY PRINTED COPIES.