// PR c++/21682 template struct t { typedef typename T::type type; }; template<> class t{}; template struct t1{ }; template<> struct t1 { typedef int type; }; namespace name1 { template typename t::type begin(S const& s); namespace name2 { template typename t1::type begin(S const& s); } using name2::begin; } /* Test calling the function. */ int f(int a) { return name1::begin(a); } struct aa { typedef double type; }; double g(aa t) { return name1::begin(t); }