Commit 1f5cc9dc ended up fixing #16347 (closed). Let's add a regression test to ensure that it stays fixed.