Reproducing test case for #6797