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

--- Comment #14 from Pedro Alves <palves at redhat dot com> ---
(In reply to Jakub Jelinek from comment #12)
> The warning is about dangling else, which you have in the source.
> if (cond)
>   for (...)
>     if (cond2)
>       ...
>     else
> and while the C/C++ grammar say they bind to the inner-most if, many people
> actually mistake this.

At the risk of getting a bit off topic, or maybe generalizing in a different
direction, IMO this should be tied to the new misleading indentation tracking.

What people actually mistake is this:

 if (cond)
   for (...)
     if (cond2)
       ...
 else
   ...

While I seriously doubt anyone mistakes your example quoted above as the else
binding to the outer if.

Reply via email to