fix Issue 10836 - 'errors compiling the function' for optimized builds