When I've read S.51AAA in the past, my reading of it was that it refers to capital gains in the current year, ie an expense would not be deductible in the current year if the only assessable income in the current year is a capital gain.
It doesn't say anything about an expense not being...