Out of curiosity. dmd still produces the if statement, although it ain't gonna happen. Same is true of "DoIt.yes". I know, it's an unlikely and marginal example.
No it doesn't, here's main:
_Dmain: push RBP mov RBP,RSP mov EDI,1 call _D7dump_if4doitFE7dump_if4DoItZv@PC32 xor EAX,EAX pop RBP ret 0f1f add [RAX],R8B .text._Dmain ends
See, no branches or comparisons.