Regression test for complex case of #9197

Closes #9197.

This test doesn't pass right now, though.