I did this (without sleeping medications) inadvertently! As someone who has slept massively and eaten minimally in the last couple of weeks due to an infection, let me remind you that weight loss achieved in this way is NOT good weight loss. For sure I have lost muscle along with fat. I feel weak and lazy. I have lost 7-8 pounds but honestly don't look any different and my clothes don't really fit differently so that is telling me something!
And now I have SO MUCH WORK to do to regain any cardiovascular and strength abilities I had worked so hard to attain.
In addition to the hazards of sleep medications, starving yourself while sleeping is so not worth it. Probably that kind of weight loss is also the kind that comes right back once you return to normal life.