More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized)