The restaurants have to pay to replace food the homeless would pick up during the day (or even put in work to prepare it for a restaurant). Food that's leftover at the end of the day and can't be sold the next day could certainly be given to the homeless for free (and I know of at least a few restaurants in my city that do this).
The homeless person sleeping in the spare room creates cleanup work, and prevents you from using that room at a moment's notice. If a homeless person could sleep in my spare room without using the shared spaces and leaving the room instantly, in perfect order, the moment I wanted to use the room, I don't think I can morally justify not letting them.
So while the situations you mention may or may not be moral, it's shifting the debate back into a worldview centred around scarcity.
The restaurants have to pay to replace food the homeless would pick up during the day (or even put in work to prepare it for a restaurant). Food that's leftover at the end of the day and can't be sold the next day could certainly be given to the homeless for free (and I know of at least a few restaurants in my city that do this).
The homeless person sleeping in the spare room creates cleanup work, and prevents you from using that room at a moment's notice. If a homeless person could sleep in my spare room without using the shared spaces and leaving the room instantly, in perfect order, the moment I wanted to use the room, I don't think I can morally justify not letting them.
So while the situations you mention may or may not be moral, it's shifting the debate back into a worldview centred around scarcity.