Translation unit #1:namespace A { struct S {}; void f(S&, long x, int y); // #3 void g(S&, int x); // #4 }
Translation unit #2:namespace A { struct S {}; void f(S&, int x, long y); // #5 void g(S&, long x); // #6 } template <typename T> void h(T& t) { f(t, 1, 1); // Selects #5 in h<A::S>, would be ambiguous call if all declarations were considered. g(t, 1); // Selects #6 in h<A::S>, would select #4 if all declarations were considered. } — end example]