Add test for #11677

This code used to cause an ICE

Closes #11677