On 03/18/2012 11:32 AM, Paolo Carlini wrote:
+ if ((TREE_CODE (type) == REFERENCE_TYPE + && lvalue_p (expr) + && same_type_p (TREE_TYPE (expr), TREE_TYPE (type))) + || same_type_p (TREE_TYPE (expr), type)) + warning (OPT_Wuseless_cast, "useless cast to type %qT", type);
I think instead of just lvalue_p (expr) you want TYPE_REF_IS_RVALUE (type) ? xvalue_p (expr) : real_lvalue_p (expr) where xvalue_p is a new function that just does return lvalue_kind (expr) == clk_rvalueref; Jason