#include #include struct base { virtual ~base() {} }; void foo( int , virtual base& , int ); struct derived : base { }; void foo_( int, static base&, int) { } void foo_( int, static derived&, int) { } int main() { try { base& d = *new derived; base& b = *new base; std::cout << (void*) foo_cmm_getimpl( b) << "\n"; std::cout << (void*) foo_cmm_getimpl( d) << "\n"; void (*fn)( int, base&, int) = foo_cmm_getimpl( d); fn( 0, d, 1); return 0; } catch( std::exception& e) { std::cerr << "error: " << e.what() << "\n"; } }