// Copyright David Abrahams 2002. Permission to copy, use, // modify, sell and distribute this software is granted provided this // copyright notice appears in all copies. This software is provided // "as is" without express or implied warranty, and with no claim as // to its suitability for any purpose. #include #include #include #include using namespace boost; template void assert_same(S, type* = 0) { BOOST_STATIC_ASSERT((is_same::value)); } template void assert_mf_cast(F f, type* = 0, type* = 0) { assert_same( python::detail::member_function_cast::stage1(f).stage2((Target*)0).stage3(f) ); } struct X { int f() const { return 0; } void g(char*) {} }; struct Y : X { }; struct Z : Y { int f() const { return 0; } void g(char*) {} }; int main() { assert_mf_cast(&X::f); assert_mf_cast(&X::g); assert_mf_cast(&Z::f); assert_mf_cast(&Z::g); assert_mf_cast(3); assert_mf_cast(X()); return 0; }