Add a test case for #5949
Add testcase for #4267