prog.cpp: In function ‘int main()’:
prog.cpp:23:30: error: no matching function for call to ‘Foo<int>::Bar<int>::foo(Foo<char>::Bar<char>)’
i.foo(Foo<char>::Bar<char>());
^
prog.cpp:23:30: note: candidate is:
prog.cpp:11:14: note: template<class X, class Y> void Foo<T>::Bar<U>::foo(const typename Foo<X>::Bar<Y>&) [with X = X; Y = Y; U = int; T = int]
void foo(const typename Foo<X>::template Bar<Y>& b)
^
prog.cpp:11:14: note: template argument deduction/substitution failed:
prog.cpp:23:30: note: couldn't deduce template parameter ‘X’
i.foo(Foo<char>::Bar<char>());
^