Add testcase from #2946.