fix Issue 10475 - destructor is called on 'for' loop variable even when initialization failed