Add a regression test for #16240