[BUG REPORT]: Potential bug with class:: pointers to member functions.

Eric McDonald emcdonal@cps.cmich.edu
Tue May 5 00:50:00 GMT 1998


Compilers Killed: egcs-1.0.2, gcc-2.8.1
CC: bug-g++, egcs-bugs

NOTE: I did not see this bug listed in the info pages of either compiler.
Please accept my apologies if this is already a known bug.

The Compilers:
Reading specs from
/home/users/m/emcdonal/gcc-2.8.1/lib/gcc-lib/sparc-sun-solari
s2.5.1/2.8.1/specs
gcc version 2.8.1
Reading specs from
/home/users/m/emcdonal/egcs-1.0.2/lib/gcc-lib/sparc-sun-solar
is2.5.1/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)

The System (probably not relevant):
SunOS cps228 5.5.1 Generic_103640-08 sun4u sparc SUNW,Ultra-1

The Situation:
ParserException is a child of GeneralException  (i.e., ParserException :
public GeneralException)
ParserException is an "inner class" of Parser  (i.e., Parser::
ParserException)
GeneralException has a void (*)() member (a function pointer), funcHandler.
ParserException overrides this with a void (Parser::*)() member, funcHandler.
Everything compiles OK until I get to the part where I actually want to
invoke funcHandler.
No strange casting is occuring (at least not explicitly, :-), and
ParserException is only being passed functions which are members of Parser
(cleanup methods that correspond to the various stages of parsing).
The compiler does not complain about the usage of funcHandler() inside of
GeneralException:: ExecuteHandler().
The compiler does complain about the usage of funcHandler()  (the
overriden, Parser::* version) inside of Parser:: ParserException::
ExecuteHandler(). Here are the errors (relevant code snippets will follow);
one pass using just a plain call    funcHandler()    and a second pass
using   this->funcHandler():

EGCS 1.0.2  and GCC 2.8.1 (funcHandler() version):
(other objects were compiled w/o error, including parser.o and genexcept.o)
make compiler             
g++ -g3 -DDEBUG=1 -O0 -Wall -W -Wno-comment -DLIBSTDCPP   -c parserexcept.cc
parserexcept.cc: In method `void Parser::ParserException::ExecuteHandler()':
parserexcept.cc:24: cannot convert a pointer of type
`Parser::ParserException' t
o a pointer of type `Parser'
parserexcept.cc:24: must use .* or ->* to call pointer-to-member function
in `Pa
rser::ParserException::funcHandler (...)'
*** Error code 1
make: Fatal error: Command failed for target `parserexcept.o'

EGCS 1.0.2  and GCC 2.8.1 (funcHandler() version w/o "noise"):
g++ -c parserexcept.cc
parserexcept.cc: In method `void Parser::ParserException::ExecuteHandler()':
parserexcept.cc:24: cannot convert a pointer of type
`Parser::ParserException' t
o a pointer of type `Parser'
parserexcept.cc:24: must use .* or ->* to call pointer-to-member function
in `Pa
rser::ParserException::funcHandler (...)'

EGCS 1.0.2 (this->funcHandler() version, aka. "compiler-killer"):
g++ -c parserexcept.cc
parserexcept.cc: In method `void Parser::ParserException::ExecuteHandler()':
parserexcept.cc:24: Internal compiler error.
parserexcept.cc:24: Please submit a full bug report to `egcs-bugs@cygnus.com'.

GCC 2.8.1 (this->funcHandler() version, aka. "compiler-killer"):
g++ -c parserexcept.cc
parserexcept.cc: In method `void Parser::ParserException::ExecuteHandler()':
parserexcept.cc:24: Internal compiler error.
parserexcept.cc:24: Please submit a full bug report to
`bug-g++@prep.ai.mit.edu'



More information about the Gcc-bugs mailing list