There was a time when I used to say that the children of the Muslims will be with the Muslims and the children of the polytheists will be with the polytheists, until so-and-so reported to me from so-and-so that the Messenger of Allah ﷺ was asked about them and he said, "Allah knows best what they would have done."So I met the man, and he informed me of this, and I refrained from saying what I had been saying.
حدثنا عفان حدثنا حماد يعني ابن سلمة أخبرنا عمار يعني ابن أبي عمار
أتى علي زمان وأنا أقول أولاد المسلمين مع المسلمين وأولاد المشركين مع المشركين حتى حدثني فلان عن فلان أن رسول الله ﷺ سئل عنهم فقال الله أعلم بما كانوا عاملين قال فلقيت الرجل فأخبرني فأمسكت عن قولي
Its isnad is sahih. Ammar bin Abu Ammar Makki is trustworthy, and his hadith appears in Sahih Muslim and elsewhere.The hadith was narrated by Muslim, 4/2048, no. 2658, in the Book of Divine Decree, chapter on the ruling concerning the death of the children of polytheists, and by Abu Dawud, 4/228, no. 4711, in the Book of Sunnah, chapter on the offspring of polytheists, and by Nasai, 4/58, in the Book of Funerals, chapter on the children of polytheists. Bukhari narrated something similar, 3/245, no. 1389, in Fath al-Bari.