Add regression test for #8142