https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114763
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- 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.