Summary
In this episode, Jason explores GCC's new -Wnrvo warning flag which detects when Named Return Value Optimization (NRVO) cannot be applied in situations where developers might expect it. He demonstrates several code examples showing when return value optimization is guaranteed by the standard (since C++17 when constructing objects directly in return statements) versus cases where the compiler cannot optimize away copies/moves due to having multiple potential return values. This diagnostic tool can help developers write more efficient code by structuring functions to leverage guaranteed RVO.