In one sense, it happens passively at every battlefield hospital in the triage area.
They have a group called the "expectants" that they intentionally don't treat because they're considered impossible to fix...they are expected to die. Therefore, they operate first on those who have a chance to live.
That's both enemy and FRIENDLY casualties.
A pair of morphine syrettes might have done the same trick, without exposing the CAPT to a court martial.
A bullet is cheaper and faster.
My father in law, who was a Marine radioman on Iwo Jima, says they did not shoot Japs who were on fire, coming out of caves after being flamed. "Let them burn" was the prevailing sentiment.
How times change. Now a mercy killing gets you charged.