And here's the second half: we were failing to consider the type of a functional cast when comparing arguments, so we thought the partial instantiation of test(int) was the same as the primary template. Applying to trunk.