template< class T > struct remove_pointer                    {typedef T type;};
template< class T > struct remove_pointer<T*>                {typedef T type;};

template<class ptr_to_t>
void f(ptr_to_t x) {
    typedef ptr_to_t t; // does not compile
    typename remove_pointer<t>::type elem = *x;
}

int main()
{
    int five = 5;
    f<int*>(&five);
    return 0;
}