This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
either g++ fails to properly typecheck pointer-to-member assignment, or I am on some bad crack
- To: egcs-bugs at cygnus dot com
- Subject: either g++ fails to properly typecheck pointer-to-member assignment, or I am on some bad crack
- From: Corey Kosak <kosak at cs dot cmu dot edu>
- Date: Thu, 15 Jan 1998 22:10:16 -0500
% g++ -v
Reading specs from /home/kosak/bloco/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.04/specs
gcc version egcs-2.91.04 980115 (gcc-2.8.0 release)
% cat member-function-bug.cc
#include <iostream.h>
class cow {
public:
void moo (char *x);
void func();
};
void cow::moo(char *x)
{
cout <<"Hello, welcome to coo::moo(char*)\n";
cout <<"x is " <<x <<"\n"; // segfault here because I got the wrong thing
}
void cow::func()
{
void (cow::*fp)(int) = &moo; // I deserve a type mismatch
(this->*fp)(77);
}
int main()
{
cow x;
x.func();
}
% g++ member-function-bug.cc
% ./a.out
Hello, welcome to coo::moo(char*)
Segmentation fault