Australian building law requires that in an emergency, the toilet door can be removed by someone on the outside. For example, in most cases, toilet doors must open outwards, slide, or be readily removable from the outside of the compartment. This requirement only applies if the space between the toilet pan and the door is less than 1200mm.
An inward swinging toilet door with lift-off hinges will typically have a gap between the top of the door and the underside of the head of the door frame. This is to allow sufficient movement upward so the pin in the door hinges can slip out of the hinge-blades screwed to the side of the door frame or style.
A suitable door latch should allow the door to be lifted upward and away even if it is in a locked position.