Hi,

"g++ -Wall -Wextra ..." should flag a warning on the following code
but does not.

std::pair<int, const XYZ&>
get_XYZ_data()
{
    XYZ result;
    return std::pair<int, const XYZ&>(1, result);
}

This is a violation of Scott Meyer's "Effective C++" Item 21 "Don't
try to return a reference when you must return an object."  GCC
version 4.5.2 on Kubuntu 11.04 does not issue a warning.

I apologize for not subscribing to the mailing list or submitting via
GCC Buzilla.

Regards,
Fung Chai.

--
FWIW: $\lnot \exists x \, {\rm Right} (x) \leftarrow \forall x \, {\rm
Wrong} (x)$ \hfill -- Stephen Stills

Freedom's just another word for nothin' left to lose -- Kris Kristofferson

Reply via email to