Add regression test for ICE from issue 10846.

Includes a bit more comments than usual for a regression test; I felt like documenting Niko's diagnosis of the original problem here. 

Fix #15111 

r? anyone.