https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20906
--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- With a slight change in the parse tree, we get a much better message. prog.cc:3:38: error: wrong number of template arguments (0, should be 1) template<int k> void foo<k>::pop(bar<>&, int) {} ^ prog.cc:1:22: note: provided for 'template<int <anonymous> > struct bar' template<int> struct bar {}; ^~~ prog.cc:3:22: error: prototype for 'void foo<i>::pop(int&, int)' does not match any in class 'foo<i>' template<int k> void foo<k>::pop(bar<>&, int) {} ^~~~~~ prog.cc:2:35: error: candidate is: void foo<i>::pop(bar<i>&, int) template<int i> struct foo { void pop(bar<i>& b, int j); }; ^~~ Comparing these two cases should point out at the solution.