D1: 4269 case 13:invalid template accepted if evaluated while errors are gagged

D1 version of previously merged pull request