I think this point has been discussed, but I can't find much in the way of commentary.
HMRC accept that crediting of the loan account with a dividend or bonus gives rise to an income tax charge and thus takes that repayment out of the anti-avoidance rules at s464C of CTA 2010.
But what about the case where the shareholder (or his partnership) raises a bona fide invoice to the company from one of his other unincorporated businesses, and that invoice is "settled" by way of off-set against the loan account? The raising of the invoice will of course give rise to an income tax charge, but the actual "repayment" of the loan, ie the offset, does not. So would s464C remain in point? And if so, does this also mean that dividends and bonuses need to be credited directly to the loan account (rather than taken to creditors at the time of declaration and subsequently set against the loan account)?