https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89976

--- Comment #2 from Nikita Kniazev <nok.raven at gmail dot com> ---
The same warning as when the object is constructed inside the main function:

int main()
{
    XorYorZ x;
    return x.x;
}

Also, the warning is not triggered in C++17+ mode with:

XorYorZ foo()
{
    return XorYorZ();
}

where the guaranteed return value optimization have to happen and the code
must have the same meaning as:

int main()
{
    XorYorZ x = XorYorZ();
    return x.x;
}

which triggers the warning, and is the same as just `XorYorZ x;` because of
the presence of the user defined constructor in X/Y/Z and copy/move elision.

Reply via email to