http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18610
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-21 13:09:55 UTC --- But I think it can be considered fixed for 4.7 by Nathan's excellent work in giving reasons why candidate functions are not viable: t.cc: In function 'int f()': t.cc:17:9: error: no matching function for call to 'g(F<int>&)' t.cc:17:9: note: candidate is: t.cc:12:22: note: template<class T> F<typename Q<T>::t> g(const F<T>&) t.cc:12:22: note: template argument deduction/substitution failed: t.cc: In substitution of 'template<class T> F<typename Q<T>::t> g(const F<T>&) [with T = int]': t.cc:17:9: required from here t.cc:12:22: error: invalid use of incomplete type 'struct Q<int>' t.cc:2:8: error: declaration of 'struct Q<int>'