This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Q: Assignment to pointer to member function oddities.
- To: Egcs Bugs <egcs-bugs at cygnus dot com>
- Subject: Q: Assignment to pointer to member function oddities.
- From: Sergei Organov <osv at javad dot ru>
- Date: Thu, 30 Jul 1998 13:52:54 +0400
- Organization: Javad Positioning
Hello;
Could somebody explain the behavior of egcs g++ (1.0.3)
compiling the following code, please:
$ cat test.cc
class B
{
public:
virtual void foo();
};
typedef void (B::*BFunc)();
BFunc f1, f2, f3;
void boo(B* b)
{
f1 = &B::foo; // OK
f2 = b->foo; // (14) ???
f3 = &b->foo; // (15) ???
}
$ ~/local/bin/g++ -W -Wall -c test.cc
test.cc: In function `void boo(class B *)':
test.cc:14: warning: assuming pointer to member function is non-virtual
test.cc:15: assignment to `void (B::*)()' from `void (B::**)()'
$
I think (14) shouldn't compile at all.
Don't know about (15).
Regards,
Sergei Organov