Do expressions fun
and &fun
have the same type or not?
Consider the following code:
template <typename Check, typename T>
void check(T)
{
static_assert(is_same<Check, T>::value);
}
void fun()
{}
check<void(*)()>(fun);
check<void(*)()>(&fun);
cout << typeid(fun).name() << endl;
cout << typeid(&fun).name() << endl;
Both assertions succeed which suggests that both expressions have the same type. However, typeid
s return different results:
FvvE
PFvvE
Why is that?