So something bad is about to happen; a nuclear weapon is about to go off, or an asteroid is about to impact the planet and the only way to avoid this is if someone stays behind and sacrifices themselves to stop it. But who will go? All of these characters are life long friends. There's no easy way to decide. Or is there? One of the characters has an Incurable Cough of Death and only a few months to live. He'll do it - after all, he's dying anyway, and in a far less dramatic and spectacular way.
This trope is about when a character gives their life for something based on the reasoning that they're going to die soon anyway. It's a favorite for when a writer wants to make a bittersweet ending less bitter.
Occasionally, the doctor will burst in just a second too late to explain that he tested the wrong vial and the character isn't (wasn't) going to die. Oh well, it's too late now!
Compare The Last Dance.
As a Death Trope, all Spoilers will be unmarked ahead. Beware.
Played straight with Kimimaro, who dies with his weapon just centimeters away from piercing Gaara's eye. If he was that fast and strong when he was dying of terminal illness, then think about how fast and strong he was when he was healthy.
Subverted later in the Sasuke vs. Itachi fight. Itachi appears as though he's about to kill Sasuke, when he keels over dead after coughing up copious amounts of blood throughout the fight. But then it's revealed that even if he hadn't died from his illness, he wouldn't have killed Sasuke anyway. Especially convenient for anybody standing in Itachi's way; when he was healthy, he completely wrecked two of Konoha's strongest shinobi without breaking a sweat.
Hohenheim offers to do this to bring Alphonse back since his ontological inertia has been broken down in the battle and he is dying anyway. Ed refuses and sacrifices his own ability to do alchemy instead. Hohenheim went and died smiling on his wife Trisha's grave instead.
Early in the X-Men comics, Professor Xavier died. Then he returned. It was explained via flashback that a terminally ill mutant scallywag calling himself the Changeling offered to pose as Xavier so the Prof could prepare for an imminent invasion. Jean knew, so as to help the shape-shifter better pass off as the X-Men's mentor.
In "MGLN Crisis", the clones of Miyuki and Kyouya, according to Shamal, have about a year to live. They make a Heroic Sacrifice toward the end of the fic.
Films — Animated
Played with in Madagascar: Escape 2 Africa with Melman also going to jump into a volcano. Also never sick.
Films — Live-Action
Near the beginning of Space Cowboys, Tommy Lee Jones' character is told he has pancreatic cancer with only eight months to live. The only way to save the world from a Russian satellite armed with nuclear missiles is for somebody to fly it into the moon. Since he is dying, and going there has been his lifelong dream, guess who volunteers.
In Repo! The Genetic Opera, Rotti Largo is told that whatever illness he has is terminal, so he sets the movie's plot in motion, namely naming Shilo as the heir to Gene Co. He dies at the end of the movie.
After Snape kills Dumbledore at the end of Harry Potter and the Half-Blood Prince, readers are informed in Deathly Hallows that the curse on Dumbledore's hand was slowly killing him. He had ordered Snape to kill him so that Draco wouldn't have to do it, thus saving Draco's soul. Interesting in that the character is not revealed to have been critically ill until after his death.
Another example where readers find out after the fact: In The Dresden Files (Death Masks), Harry is being held in a completely inescapable position by the Dangerously Genre Savvy Nicodemus, who offers him a choice between joining him or being killed. That's when Shiro barges in and offers himself in Harry's place, letting the Denarians torture him to death. A couple weeks after everything goes down, Harry gets a letter in the mail: Shiro had terminal cancer and only a few months to live.
In the novel The Wishsong Of Shannara, the Borderman Helt is attacked by a huge bat creature that scratches his face. He insists that he's okay, but not long afterward, he sacrifices himself to buy time for his comrades to escape from a horde of enemy Gnomes. Garet Jax later explains that Helt had been poisoned by the bat creature and knew he was dying.
The very first Sherlock Holmes story uses this- the murderer has Watson confirm his fatal heart condition after he's captured and dies before facing trial. Since the victims are responsible for the murder of his fiancee and her father, and were horrible human beings in general, little is made of the case.
In 24, CTU Director George Mason gets a fatal case of radiation poisoning while searching for a nuke in Day 2. At the end of the Day, Jack flies an airplane carrying the nuke on a suicide course to the desert to prevent it from killing anyone, only for a stowaway Mason to reveal himself, convince Jack to not throw his life away and take his place at the controls while Jack parachutes to safety. It helps that while Mason was dying, he looked back on his life and realized how much he had made everyone close to him dislike him, which caused him to try make amends with his remaining time. Being poisoned not only gave him a reason to sacrifice himself in another's place (he says that he'd rather not suffer the end stage poisoning effects), but most likely was why he would even consider doing so.
In the JAG episode "Enemy Below", the Russian crew aboard the diesel submarine Al-Qaeda bought from Iran succumbs to radiation poisoning because the dirty nuke is un-shielded.
In Final Fantasy X, Seymour's mother indirectly cites this as being part of her willingness to sacrifice herself to become his Final Aeon, with which he could destroy Sin and save the world. Uniquely for this trope, it manages to backfire spectacularly, because what any outcast Half-Human Hybrid needs is for his mother to lay the weight of saving the world on his shoulders as she kills herself/leaves him forever. Is it any wonder he winds up a Woobie, Destroyer of Worlds?
Subverted in Dragon Age: Origins. Near the end of the game it's revealed that only a Grey Warden can kill the Archdemon, and only at the cost of their own life. Riordan volunteers, reasoning that he has been a Grey Warden for much longer than Alistair, Loghain, or the Player Character, and only has a few months left before the Darkspawn Taint takes him anyway. The other characters seem to agree with this. However, Riordan ultimately fails to kill the Archdemon, leaving you in the same Someone Has to Die situation you were in before.
Ion in Tales of the Abyss conveniently comes up with a case of Almost Dead Guy from being killed by Mohs at the point where Tear's illness is beginning to kill her, allowing him to use a Heroic Sacrifice to purge her body of the illness at the cost of his own life. For a double whammo of this trope, he was an unstable Replica to begin with and probably didn't have much longer to live anyway because of it.
Played for as much Tear Jerker potential as possible by Metal Gear Solid 4, where Snake's terminal illness and Incurable Cough of Death makes him reckless, self-destructive and occasionally outright suicidal, dead set on performing a Stupid Sacrifice. It's also made painful by the fact that his terminal illness means that even if he does survive all the stupid things he keeps doing to his body - which of course he knows he will - the beloved character himself is not getting out alive.