This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ compiling errors.


TazQ wrote:
> The code
> 
>   ISParse *blah = (ISParse *)ishash[what];  // Extract from hash
>   if(blah) { // If it's there
>     isfunc function = blah->func; // assign the function to a function pointer.
>     function(n, params); // Call function with current object.
>   }
> 
> This compiles fine under gcc2, and works perfectly.
> Trying to figure out above error, I tried this->*function, this->function,
> this.function, this.*function, and none of them compiled.
> 
> Please advise...

I agree it is not a very useful error message.
Try:
	(this->*function)(n, params);

The reason is that ->* (and .*) has a lower precedence than a function
call.

PKE.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]