According to the building codes in my area (Ontario, Canada) a room can only be used as a bedroom if it contains "...two accessible means of egress."
What that means is that if you have a door out of the room and one other exit (which can be a window) then that can be used as a bedroom. Or if you have a door on one end of the room, and another door that exits to another part of the home, that can be used as a bedroom. Whether it has a closet or not does not come into play.
The other restriction in my area... Any room that could potentially be used as a bedroom must contain a smoke detector, regardless if the room will ACTUALLY be a bedroom. For example, I had to install a smoke detector in my home office and a hobby room (for model trains), even though both of these will never be used as a bedroom.