My interpretation of CRA T4037 and IT120 would be that if you own a duplex, only a portion of it is eligible for the principal residence exemption in the first place, and that the rental portion is subject to capital gains. But I suspect this is often skirted around, either by non-reporting or by stretching the meaning of s.32 of IT120.
Your principal residence can be any of the following types of housing units:
°Ω a house;
°Ω a cottage;
°Ω a condominium;
°Ω an apartment in an apartment building;
°Ω an apartment in a duplex; or ...
If only a part of your home qualifies as your principal residence and you used the other part to earn or produce income, you have to split the selling price and the adjusted cost base between the part you used for your principal
residence and the part you used for other purposes (for example, rental or business). You can do this by using square metres or the number of rooms, as long as the split is reasonable. Report only the gain on the part you used to produce income. For more information, see “Real estate, depreciable property, and other properties” on page 16 and Interpretation Bulletin IT-120, Principal Residence. Form T2091(IND), Designation of a Property
IT 120:
32. It is our practice not to apply the deemed disposition rule, but rather to consider that the entire property retains its nature as a principal residence, where all of the following conditions are met:
(a) the income-producing use is ancillary to the main use of the property as a residence,
(b) there is no structural change to the property, and
(c) no CCA is claimed on the property.
These conditions can be met, for example, where a taxpayer carries on a business of ..., rents one or more rooms in the home, or ....