https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968
--- Comment #10 from Ivan Sorokin <vanyacpp at gmail dot com> --- One more case (from 108676): template <typename T> struct X {}; template <typename U> X<U&> f(); template <typename V> X<V&> g(); int main() { g<void>(); } Here 'X<U&>' is printed in the error message instead of 'X<V&>'.