
Sean Parent wrote:
On Dec 6, 2004, at 2:02 PM, Peter Dimov wrote:
I get warning C4172 from VC++ 7.1, "returning address of local variable or temporary", on this example (in function_template.hpp:111).
In CodeWarrior 9.3 BOOST_NO_VOID_RETURNS is not defined so in function.hpp the code falls into the static_cast<> case
-----
# ifndef BOOST_NO_VOID_RETURNS return static_cast<result_type>(result); # else return result; # endif // BOOST_NO_VOID_RETURNS
------
This silences the warning - and you get no indication that anything is wrong.
Not good. :-) FWIW, VC++ 7.0+ do not define BOOST_NO_VOID_RETURNS either.
Just to make sure - you plan to leave it returning by value? If that is the case I'll update my code (I had patched my copy of boost).
Yes, return by value still seems to be the lesser of the two evils, since we can deal with the problematic case on boost::function's side, if Doug doesn't mind (the problem there is not bind-specific).