Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!CS.UTAH.EDU!donn From: donn@CS.UTAH.EDU (Donn Seeley) Newsgroups: gnu.g++.bug Subject: Re: g++ bugs Message-ID: <8907250029.AA20835@cs.utah.edu> Date: 25 Jul 89 00:29:53 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 37 typedef int (*PF)(); class foo_c { PF fp; public: void m(); }; void foo_c::m() { return fp(); } G++ 1.35.0 produces the error message 'component `fp' is not a method'. There appears to be a logic error in the function hack_identifier in cplus-method.c, which persists in G++ 1.35.1 (which we aren't running since we're waiting for 1.36.0). The special case of a data member that is a pointer to a function or to a member function is incorrectly recognized; here's the fix I made: *** /tmp/,RCSt1009094 Mon Jul 24 18:17:24 1989 --- cplus-method.c Mon Jul 24 17:50:04 1989 *************** *** 2171,2178 **** && TREE_CODE (type) != FUNCTION_TYPE && TREE_CODE (type) != METHOD_TYPE && (TREE_CODE (type) != POINTER_TYPE ! || TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE ! || TREE_CODE (TREE_TYPE (type)) != METHOD_TYPE)) { error ("component `%s' is not a method", IDENTIFIER_POINTER (name)); --- 2171,2178 ---- && TREE_CODE (type) != FUNCTION_TYPE && TREE_CODE (type) != METHOD_TYPE && (TREE_CODE (type) != POINTER_TYPE ! || (TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE ! && TREE_CODE (TREE_TYPE (type)) != METHOD_TYPE))) { error ("component `%s' is not a method", IDENTIFIER_POINTER (name)); Donn Seeley University of Utah CS Dept donn@cs.utah.edu 40 46' 6"N 111 50' 34"W (801) 581-5668 utah-cs!donn