Court overturns ‘right to sex’ ruling on man who cannot understand consent