https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66596
--- Comment #1 from Ed Catmur <ed at catmur dot co.uk> --- Note: error produced is: prog.cc: In instantiation of 'void g() [with T = int]': prog.cc:6:21: required from here prog.cc:5:30: error: 'U::f()' is not a member of 'V' template<class T> void g() { t<T>.f(); } ^ If the type of the non-specialized variable template t is made formally dependent on its template parameters, then the program compiles fine: template<class T> decltype((T*)0, *(U*)0) t; template<> V t<int>;