Hi,
I have found that `Sema::CheckReturnStackAddr` failed to generate warnings for `diag::warn_ret_stack_ref` and `diag::warn_ret_local_temp_ref` when the return value expression is an explicit cast.
Provided the following code,
const int &test1()
{
return 0;
}const int &test2()
{
int val = 0;
return val;
}const int &test3()
{
return static_cast<const int &>(0);
}const int &test4()
{
int val = 0;
return static_cast<const int &>(val);
}
Clang (as of r194251) generates warnings for `test1` and `test2`, however, no warnings are given for `test3` and `test4`.
GCC (4.8.1) is able to successfully generate warnings for all of the above.
sema_eval_val.patch (912 Bytes)