On 2-7-2014 22:50, Liam White wrote:
On Wed, Jul 2, 2014 at 4:45 PM, Johan Engelen <jbc.engelen@...2592...> wrote:
We could enable "-Wparentheses" for this. It also nicely catches some
other issues like:
if (x = 0) {

}
forcing one to write
if ((x = 0)) {

}
if you really meant the assignment.

So if I write

if (SPItem* item = dynamic_cast<SPItem*>(obj)) {
    // do something with item
}

Would it flag that too?

I think so. You would need double parentheses.
I am a little confused, because -Wparentheses is enabled with -Wall, which we already use...
The assignment thing is clang-only it seems. But I thought -Wparentheses also complains about operator precedence, but perhaps only with combinations of || and &&...

 - Johan