Pointer to memberfunction bug in egcs-970904

Klaus-Georg Adams Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Fri Sep 5 04:57:00 GMT 1997


egcs-970904 compiles the following program, but it shouldn't:

#include <iostream.h>

struct t {
	void cheat( int& i ) { ++i; }
};

int main()
{
        // The next line ought to be an error.
	void (t::*member)( const int& ) = &t::cheat;
	t t2;
	const int i=1;
	int j=1;
	(t2.*member)( i );
	(t2.*member)( j );
	cout << " i is: " << i << endl
	     << " j is: " << j << endl;
	return 0;
}

-- kga
-------------------------------------------------------------------------
Klaus-Georg Adams        Email: Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Institut f. Anorg. Chemie II                           Tel: 0721 608 3485
Uni Karlsruhe
-------------------------------------------------------------------------



More information about the Gcc-bugs mailing list