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]
Other format: [Raw text]

is this a g++ bug or an obscure ISO rule?


if i use the code as follows, everything is fine.  if i replace the 
"int x" with "void * x" (and cast appropriately), i get compiler 
errors.  i don't see in Stroustrup, 3rd ed, where this is an error 
with "void *".

what am i missing?  this is g++ 3.1.1 on sun-sparc-solaris2.8.

  void
  foo::foo_method( void )
  {
     int x;
     void (foo::*ptr)(void) = &foo::foo_method;

     x = (int)(this->*ptr);

     cout << "foo::foo_method lives at addr " << (int*)x << endl;
  }

thanks,

josh fryman


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