Talmud for Gittin 8:6
כָּל הָעֲרָיוֹת שֶׁאָמְרוּ צָרוֹתֵיהֶן מֻתָּרוֹת, הָלְכוּ הַצָּרוֹת הָאֵלּוּ וְנִשְּׂאוּ וְנִמְצְאוּ אֵלּוּ אַיְלוֹנִיּוֹת, תֵּצֵא מִזֶּה וּמִזֶּה, וְכָל הַדְּרָכִים הָאֵלּוּ בָהּ:
All the arayoth (illicit relations) about whom they said that their tzaroth (co-wives) are permitted, [the fifteen arayoth about whom the sages said that their tzaroth are permitted to marry without chalitzah (from the yavam)] — if these tzaroth went and married, and these [the arayoth] were found to be eiloniyoth (unable to bear children) [making it manifest, retroactively, that the dead man's (original) betrothal of them was mistaken, so that these were not (halachically) their tzaroth and were not exempt from yibum by the arayoth], she (the tzarah) leaves this one [the husband that she married] and (she leaves) this one [the yavam (i.e., he must give her chalitzah)], and all of the above applies. [In Yevamoth, this is stated to be in accordance with R. Akiva, who says that the child of a union interdicted by a negative commandment is a mamzer. This is not the halachah.]