https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45011
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |4.8.0 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Seems to have been fixed by r189640 for GCC 4.8 * pt.c (instantiate_decl): Don't recheck substitutions. At that revision we reject the testcase with this error: 45011.cc:9:17: error: template-id ‘function<C>’ for ‘void function(int)’ does not match any template declaration template<> void function<C>(int parameter) { ^ 45011.cc: In function ‘int main()’: 45011.cc:13:16: error: no matching function for call to ‘function(int)’ function<C>(0); ^ 45011.cc:13:16: note: candidate is: 45011.cc:6:27: note: template<class T> void function(typename T::Private) template<typename T> void function(typename T::Private); ^ 45011.cc: In function ‘void function(typename T::Private) [with T = C; typename T::Private = int]’: 45011.cc:3:15: error: ‘typedef int C::Private’ is private typedef int Private; ^ 45011.cc:6:27: error: within this context template<typename T> void function(typename T::Private); ^ The error changed at r195779 re PR c++/56208 (Some classic sfinae cases fail to work due to access problems) PR c++/56208 * pt.c (fn_type_unification): Discard any access checks from substituting explicit args. Since then we print: 45011.cc:9:17: error: template-id ‘function<C>’ for ‘void function(int)’ does not match any template declaration template<> void function<C>(int parameter) { ^ And the error is similar today: 45011.cc:9:17: error: template-id 'function<C>' for 'void function(int)' does not match any template declaration 9 | template<> void function<C>(int parameter) { | ^~~~~~~~~~~ 45011.cc:6:27: note: candidate is: 'template<class T> void function(typename T::Private)' 6 | template<typename T> void function(typename T::Private); | ^~~~~~~~