How is the computation mnemonic "D" an M instruction???
The fourth bit dictates whether the A register or the M register is fed to the Y-input of the ALU. Since the computation in M=D is simply D, it doesn't matter whether your instruction uses the A or the M.