> That only works with if statements, not static if statements. E.g.:

Right, but the code contains a runtime `if`.

> I've often thought about implementing the ability in dmd to fold together template instances which will generate identical code, but operate on different types.

That'd be pretty nice.

> So I'd really put this down as a compiler problem, not one with this pull.

Agreed.