I've never once answered such a question and never understood why anyone would. When they ask, you tell them you don't give out that information. I've never even had someone question that or ask twice.
I once had a recruiter (contracted) get angry and berate me when I refused to answer, then finally gave in and gave him my full compensation figure from when I worked at Google. He said I was lying and nobody would hire me at that rate. Needless to say I let him know what I thought of him and ended that contact, letting the HR department at the company for whom he was recruiting know what a jackass he was.
I also had a recruiter (in-house, working for the company) become difficult when I refused to provide current salary. She tried several times to suss it out of me and when it didn't work, discontinued the engagement, at which point the interviews stopped. I think I may have dodged a bullet.
I'm pretty sure companies have ruled me out from even contacting because I left past salary blank. I didn't check their hr boxes and that was likely one.
I would be fine with that, personally.
Unfortunately not everyone is in the position where they can just say no like that.