Add tests for issues #11384 and #12909

Closes #11384
Closes #12909

r? @nikomatsakis