Rom 2 12 All who have sinned apart from the law will also perish apart from the law, and all who have sinned under the law will be judged by the law. 13 For it is not the hearers of the law who are righteous in God’s sight, but the doers of the law who will be justified. 14 When Gentiles, who do not possess the law, do instinctively what the law requires, these, though not having the law, are a law to themselves. 15 They show that what the law requires is written on their hearts, to which their own conscience also bears witness; and their conflicting thoughts will accuse or perhaps excuse them 16 on the day when, according to my gospel, God, through Jesus Christ, will judge the secret thoughts of all.
Hebrews expresses a similar concept of Gods mercy towards unsaved Jews.
Heb 11 13 All of these died in faith without having received the promises, but from a distance they saw and greeted them. They confessed that they were strangers and foreigners on the earth, 14 for people who speak in this way make it clear that they are seeking a homeland. 15 If they had been thinking of the land that they had left behind, they would have had opportunity to return. 16 But as it is, they desire a better country, that is, a heavenly one. Therefore God is not ashamed to be called their God; indeed, he has prepared a city for them.