Following compiles perfectly fine:
struct MyClass { template void foo (SameName* p); }; struct SameName {}; template