This is another case where we have a compile-time errors (Ok with ICC). Note, with swapped From and To types compiles.
struct A { }; struct E : virtual A { }; template<bool, typename T = void> struct enable_if { typedef T type; }; template<typename T> struct enable_if<false, T> { }; template<typename From, typename To> class mini_is_convertible { typedef char one; typedef struct { char arr[2]; } two; template<typename To1> static void test_aux(To1); template<typename From1, typename To1> // static decltype(test_aux<To1>(std::declval<From1>()), one()) static typename enable_if<(sizeof(test_aux<To1>(From1()), 1) > 0), one>::type test(int); template<typename, typename> static two test(...); public: static const bool value = sizeof(test<From, To>(0)) == 1; }; int main() { mini_is_convertible<int (E::*) (int), int (A::*) (int)>::value; // compiles mini_is_convertible<int (E::*), int (A::*)>::value; // compiles mini_is_convertible<int (A::*) (int), int (E::*) (int)>::value; // doesn't mini_is_convertible<int (A::*), int (E::*)>::value; // doesn't } -- Summary: SFINAE vs pointer to member via virtual base Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: paolo dot carlini at oracle dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44908