------- Comment #1 from pinskia at gcc dot gnu dot org 2010-03-16 06:03 ------- template<typename X, typename Y /*note:unused*/ > X& first_of(X & x1, X & x2) { return x1; }
That is not a specialization which could be deduced. The correct way of writing the specialization is: template<typename X> X& first_of(X & x1, X & x2) { return x1; } As the template argument is not used, it cannot be deduced which means it has been explicit so if you call the function like: first_of<a,a> (a,b); It will use the specialization that you did. > It would be helpful to have the compiler flag this as an > unused-template-parameter warning in > specializations. I showed how it could be used without the argument being deduced. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43386