https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114763

--- Comment #3 from hanwei (K) <hanwei62 at huawei dot com> ---
(In reply to Andrew Pinski from comment #1)
> Note only the second case has if's 2 sides which are the same;
> it is basically `a ? b : (c ? d : d)`.
> 
> While the first case you have `a ? b : (c ? d : b)` which is not supposed to
> warn about at all because the 2 sides are not the same.
> 
> The reason is because that is how the grammar of C/C++ works.

So, Wduplicated-branches just check bottom two branches actually.
Because only the bottom two branches will same if we check followed the grammar
of C/C++.

Reply via email to