So let's say that any person from any religion except the Catholic religion, has lived his entire life as a non-Catholic, and has led a bad and sinful life, let's say that this person gets terribly ill or is somehow at the point of death, with only moments to live, what if this person says with sincerity, "God, forgive me! I'm sorry for my entire life and I repent of all that I have done!" and then moments later dies, does this person go straight to Hell since he/she was clearly outside the Church? He could be baptized or not baptized, I'll use both examples.
Also, this person calls out to "God" but is not even sure which God is the real God, and doesn't address any God in specific, but simply thinks of "God" as the being who rules the earth.
What about a Protestant? One who has lived his entire life as a Protestant, refusing to be Catholic and rejecting the Church? What if such a Protestant is at the point of death and says "Jesus forgive me! I repent of all the bad things I have done!", can this person go to Purgatory and hence eventually be saved, even though such a person dies clearly outside the Church?