This is a question which is somewhat “advanced” in theology and apologetics. It presumes an understanding of the Church’s teaching about venial/mortal sin.
I contend that the Catholic Church has never taught that salvation was absolutely impossible for anyone who dies in a state of mortal sin, after having attained Saving Grace (through Christian Baptism).
So, I would like to discuss the question: Does the Catholic Church teach that a Baptized person who commits unconfessed mortal sin (which would not include the intent to confess in dire circumstances where Confession was not available) has absolutely NO possibility whatsoever of salvation?
The answer to your very last question is “no,” but that is not exactly the same thing as the question in the title. Let me explain a little.
The absolute
condicio sine qua non for being saved is to die in friendship with God, which means fundamentally that at the moment of death one must possess sanctifying grace (the habitual indwelling of God in our souls that makes us righteous, holy, and pleasing to God).
If one commits a mortal sin, the gravest consequence of that sin is that it it is incompatible with sanctifying grace. By committing that sin, we make our souls inhospitable, so to speak, to the indwelling of God.
In order for us to be restored in friendship with God, God must take the initiative (like the shepherd who looks for the lost sheep) to bring us back. It is His grace that makes us repent. Now, the ordinary channel for receiving forgiveness of mortal sins (committed after Baptism) is sacramental confession: all Catholics are obliged to use this means, unless something renders that impossible.
Having said that, confession is not the
only means to obtain forgiveness for a mortal sin. There is also the act of perfect contrition, which is repentance for our sins motivated out of love for God (as opposed to something like fear of punishment).
Putting these together, we conclude the following:
(1) If someone commits a mortal sin and
refuses to repent, even on his deathbed, and he persists in this condition until the moment of death, then salvation is not possible. That is, indeed, (unfortunately) how people end up condemned.
(2) On the other hand, the mere fact that someone has committed a mortal sin and has not confessed it does not
necessarily mean that he will be condemned. In order to be saved, it would be sufficient for him to make an act of perfect contrition (which—for Catholics—includes the intention of confessing his sin when he reasonably has the opportunity) before he dies. It is certainly unwise to test fate by waiting for the last possible moment, but it is possible.
(Note that the approach of death itself may make it impossible for the penitent to approach confession, so in that case, of course, he is not obligated; the act of perfect contrition is sufficient. Invincible ignorance regarding the obligation to confess one’s sins would also excuse the person.)
It is very important to recall that God is infinitely merciful, and only He knows what is going on in people’s souls. It is possible that even a well catechized, baptized Catholic may be aware of the obligation to confess his sins, but be psychologically
unable to do so. God knows whether the person is repentant or not, and if fact, it is He who gives the grace of repentance to that person. Hence, we are not able to judge whether the person has received the grace of final perseverance or not, whatever the external appearances are.
(Naturally, that does not take away our
objective obligation to confess all our mortal sins.)