It’s pretty well-known that a foreign resident (for tax purposes) cannot get a CGT exemption for a main residence (if they are a foreign resident at the time they entered the contract of sale).
Also, if the home was acquired after 8 May 2012 they won’t be entitled to any 50% CGT discount to reduce the amount of the assessable gain. And if they acquired the home before that date, then the amount of discount available will be reduced on a (disproportionate) sliding scale.
Of course, all this means that if a person is going to become a foreign resident and they want to get the CGT exemption on their home, they need to enter that contract of sale before they leave the country (even if the appropriate transaction takes place at the airport just before they leave!)
However, what is probably less well known is that you can’t get a CGT main residence if you own the home on trust for someone else.