Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++copy elision RVO NRVOSingle-choice MCQ

With NRVO available but no guaranteed elision, what does this function do when compiled at -O2, and why?

struct S { S(); S(const S&); S(S&&); ~S(); }; S make() { S a, b; if (sizeof(int) == 4) return a; return b; } S s = make();