“Whoever commits adultery with a slave woman or a free woman, his child is illegitimate, and he cannot inherit from him or be inherited from (i.e., this child cannot inherit from him).”
Sunan Ibn Majah Book 23, Hadith 27