Revert r103133 and add testcase from PR7066.