Ali said, "Messenger of Allah, if a son is born to me after your death, may I name him after you and give him your kunya?"He replied, "Yes."In another wording, the addition reads, "So it was a special permission granted to me."
يا رسول الله، إن ولد لي من بعدك ولد، أسميه باسمك وأكنيه بكنيتك؟ قال: نعم. وزاد في لفظ: فكانت رخصة لي.
Narrated by Abu Dawud (4967), Tirmidhi (2843), Ahmad (730), and Hakim (4/278), all through the route of Fitr bin Khalifa, from Mundhir Thawri, from Muhammad bin Hanafiya, from Ali, who mentioned it. Its chain of transmission is sahih. The addition is found in Tirmidhi, Ahmad, and Hakim, but Abu Dawud did not mention it. Tirmidhi said, "This is a hasan sahih hadith," and Hakim said, "A sahih hadith according to the criterion of the two Shaykhs."As for what was narrated from Ayesha, who said that a woman came to the Messenger of Allah ﷺ and said, "O Messenger of Allah, I have given birth to a boy and named him Muhammad and gave him the kunya Abu Qasim, but I was told that you disapprove of that." He said, "What is it that permits my name but forbids my kunya?" or "What is it that forbids my kunya but permits my name?" This is munkar. It was narrated by Abu Dawud (4968) and Ahmad (25040), both through the route of Muhammad bin Imran Hajabi, from his grandmother Safiya bint Shayba, from Ayesha, who mentioned it. Muhammad bin Imran is known only through this hadith. Dhahabi said in al-Mizan (3/672), "He has a munkar hadith, and I have not seen anyone give him either criticism or endorsement." Likewise, Hafiz said in his biographical entry in al-Tahdhib (9/382), "The text is munkar, contradicting the sahih hadiths."I say, meaning the hadiths mentioned earlier prohibiting combining his name and his kunya during his lifetime ﷺ. The hadiths of the preceding chapters indicate that it is disliked to name a child Muhammad while also giving him the kunya Abu Qasim during the lifetime of the Messenger of Allah ﷺ. As for after his death, just as it became permissible to combine the two, it also became permissible to use the kunya Abu Qasim, since the prohibition regarding that was lifted, according to the soundest views of the scholars.As for Ali's statement, "It was a special dispensation for me," it appears that this is actually the statement of Fitr bin Khalifa, the Shiite narrator, and not the words of Ali , because of what is found in the Musnad of Imam Ahmad (730), "It was a dispensation from the Messenger of Allah ﷺ for Ali," which is merely his own supposition and conjecture. This is why he sometimes mentioned it and other times remained silent about it, for indeed Abu Dawud did not mention this statement at all.