I managed to track a bug down to the following expression:
foo(static_cast<T>(a, b)); // Executes specialisation 1
The closing bracket was in the wrong place. The correct statement should have been:
foo(static_cast<T>(a), b); // Executes specialisation 2
I've never seen static_cast used with the form (a,b), or seen it described anywhere. What does it mean? The former statement returned b.