[PATCH] PR12214 - warn on suspicious self-compound-assignments

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Thu May 29 19:35:12 PDT 2014


FWIW, I don't understand what it means to "assign a value to itself".
(And if you want to make it something like "assignment does not change
the value of variable %0", notice that a^=a actually does change the
value.)  Perhaps "lvalue %0 appears on both sides of (compound)
assignment" would be more accurate.

I assume this diagnostic is automatically suppressed in the case that
we're really calling an overloaded operator|= or something, right?


On Thu, May 29, 2014 at 4:25 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> Maybe tweak the diagnostic (for both this case and the normal self-assignment case) to:
>
>   explicitly assigning value of variable of type %0 to itself
>
> (Adding the 'value of' makes this message work better for the compound-assignment case.)
>
> Other than that, LGTM
>
> http://reviews.llvm.org/D3753
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list