This is a terrible first question to ask.
But it is not an illegitimate question to answer if we care about sound doctrine and the salvation of souls.
The great Puritan theologian John Owen (1616-1683) wrote:
Men may be really saved by that grace which doctrinally they do deny;
and they may be justified by the imputation of that righteousness which in opinion they deny to be imputed. (The Doctrine of Justification by Faith Alone in Owen’s Works 5:163-64)
Owen’s position seems dangerous. After all, Scripture makes a strong connection between sound doctrine and assurance. And couldn’t Owen’s position encourage doctrinal laxity?
But not necessarily.
John Piper agrees with Owen’s assessment but adds this qualifier:
The clearer the knowledge of the truth and the more deep the denial, the less assurance one can have that the God of truth will save him. Owen’s words are not meant to make us cavalier about the content of the gospel, but to hold out hope that men’s hearts are often better than their heads. (The Future of Justification, 25 n. 30)
I think this is what J. I. Packer meant when he tries to analyze distorted doctrine from a pastoral perspective:
It is certain that God blesses believers precisely and invariably by blessing to them something of his truth and that misbelief as such is in its own nature spiritually barren and destructive.
Yet anyone who deals with souls will again and again be amazed at the gracious generosity with which God blesses to needy ones what looks to us like a very tiny needle of truth hidden amid whole haystacks of mental error. . . .
Every Christian without exception experiences far more in the way of mercy and help than the quality of his notions warrants. (Keep in Step with the Spirit, 21-22).
Jonathan Edwards offers a similar statement to Owen’s but goes into greater detail with various options regarding the denial—emphasizing how dangerous false teaching is but also hoping that such a person may be teachable when confronted with his error:
How far a wonderful and mysterious agency of God’s Spirit may so influence some men’s hearts, that their practice in this regard may be contrary to their own principles, so that they shall not trust in their own righteousness, though they profess that men are justified by their own righteousness—
or how far they may believe the doctrine of justification by men’s own righteousness in general, and yet not believe it in a particular application of it to themselves—
or how far that error which they may have been led into by education, or cunning sophistry of others, may yet be indeed contrary to the prevailing disposition of their hearts, and contrary to their practice—
or how far some may seem to maintain a doctrine contrary to this gospel-doctrine of justification, that really do not, but only express themselves differently from others;
or seem to oppose it through their misunderstanding of our expressions, or we of theirs, when indeed our real sentiments are the same in the main—
or may seem to differ more than they do, by using terms that are without a precisely fixed and determinate meaning—
or to be wide in their sentiments from this doctrine, for want of a distinct understanding of it;
whose hearts, at the same time, entirely agree with it, and if once it was clearly explained to their understandings, would immediately close with it, and embrace it:—
how far these things may be, I will not determine; but am fully persuaded that great allowances are to be made on these and such like accounts, in innumerable instances; though it is manifest, from what has been said, that the teaching and propagating [of] contrary doctrines and schemes, is of a pernicious and fatal tendency. (“Justification by Faith Alone,” in Yale’s Works of Jonathan Edwards 19:242.)
In a recent post on this subject, Michael Horton quotes the Reformed theologian Herman Witsius who thought carefully about this:
To point out the articles necessary for salvation, and precisely to determine their number, is a task, if not utterly impossible, at least extremely difficult. . . .
It does not become us to ascend into the tribunal of God, and to pronounce concerning our neighbor, for how small a defect of knowledge, or for how inconsiderable and error, he must be excluded from heaven. It is much safer to leave that to God. It may not be safe and expedient for us to receive into church-fellowship a person chargeable with some error or sin; whom, however, we should not dare, on account of that error or sin, to exclude from heaven. (Sacred Dissertations on the Apostles’ Creed, Vol. 1. Grand Rapids: Reformation Heritage Books, 2010, 16, 27-29)
Horton offers his own conclusion:
Paul reminds all of us with Timothy that only the Lord knows his elect. Pastors and elders in council may approve valid professions of faith and guard the ministry of preaching, sacrament, and discipline, but only the Great Shepherd can separate the sheep from the goats on the last day. Until then, our calling is to entrust ourselves to faithful shepherds and to long earnestly and prayerfully for the repentance of those who have strayed from Christ’s Word.
For more on this, see Horton’s posts “How Much Do I Need to Know?” “How Far Is Too Far?” He is especially helpful in identifying two common errors: (1) assuming that we only need to know the bare minimum that is necessary for salvation; (2) assuming that we need to know everything correctly in order to be saved.