------- Comment #9 from nathan at gcc dot gnu dot org 2006-01-19 14:22 ------- The bug appears to be not in the deduction machinery, but in the instantiation machinery. In all cases we end up calling _Z8qCompareIcEiPKT_S2_, but the body of that function differs! Using the example in comment #4, we get a return value of 1. If either of the two alterations are done, we get a return value of 4.
Another difference in the assembly is that the unmodified code of comment #4 contains an instantiation of _Z8qCompareIccEiPKT_PKT0_, whereas the other two do not. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25855