1) Set up a course where guest access is not allowed
2) As an admin or teacher in this course, choose "Switch role to..." -> "Guest"
3) You get a page with "Sorry, 'Name of course' does not allow guests to enter. and a "Continue button".
4) Click on the continue button
5) You're redirected to the login page.
6) Switching again to the course brings you to the same page as described in step 4)
7) Only way to get out this is clicking on "Return to my normal role" in the top right corner of the page
After step 4), return to the course page with normal role.