(btw: there is not even any function in the struct S which I could point to ;). But you're right. The C++ syntax is really tricky on this stuff.. void(S::*foobar)()const would be a variable declaration of a pointer-to-function of type void(S::*)()const where the variable name is foobar. Something like &S::foobar would have been a pointer to a function "foobar" if that function would exist.)
Edit: oh, wait.. you mean I pass a non-const pointer to a const function, not a const pointer to a non-const function... hm... but in this case, T* should specialize, which doesn't do either.
Then again... a pointer to a member function is not a normal pointer anyway. (E.g. you can't assign it to void*.)
In test in the original post fails because the pointers don't point to the same type of functions ( a non-constant member function is not the same as a constant one) - so the two S::* pointers
types are different.
So now:
1 2 3 4 5 6 7
//OK (but NOT invoking struct remove_const< const T> template)
//this corrects the original post
static_assert(same_type<remove_const<void(S::*)()const>::type, void(S::*)() const>::value == 1, " :-( ");
//OK - This one will invoke the struct remove_const< const T > template
static_assert(same_type<remove_const<void( S::* const)()const>::type, void(S::*)() const>::value == 1, " :-( ");