Add a test for #5844 (a closed issue now)