"Daniel T." <danie...@earthlink.net> wrote:
#include <cassert>
class Foo {
public:
virtual void fnA() = 0;
virtual void fnB() = 0;
};
int main() {
assert( &Foo::fnB );
assert( &Foo::fnA );
}
What does the standard say about the above code?
There should be no problem with it.
In the compiler I'm using now, the first assert will not fire,
but the second one will. I expected that neither assert would
fire...
It's guaranteed by the standard. It works with the three
compilers I have access to (Sun CC, g++ and VC++), at least when
you compile in standard conformant mode. (Note that by default,
pointers to member functions do not work in VC++. You must use
the option /vmg. Not that I think that their non-conformity
otherwise would play a role here.)