Regression test for issue 2842