On 03/16/2012 05:42 PM, Paolo Carlini wrote:
3- References can be easily missed because wrapped in INDIRECT_REF: as
explained at the beginning of tree.c and already used in many places, a
REFERENCE_REF_P check (and in case a TREE_OPERAND (expr, 0)) takes care
of that. I'm not 100% sure the solution is fully general, though.
That won't catch something like
int i;
static_cast<int&>(i);
which is also a useless cast, because i is already an int lvalue; not
all lvalues are derived from references. Note that something like
static_cast<int&&>(42);
is not a useless cast, because it turns a prvalue into an xvalue.
Jason