<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Warn on semicolons immediately following "else""
   href="https://bugs.llvm.org/show_bug.cgi?id=35319">35319</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Warn on semicolons immediately following "else"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>brettw@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang version 6.0.0 (trunk 317263)

This code:

    int main(int argc, char** argv) {
      if (argc > 4);   // <-- Note semicolon!
      return 0;
    }

Gives:

    eraseme.cc:2:16: warning: if statement has empty body [-Wempty-body]
      if (argc > 4);
                   ^
    eraseme.cc:2:16: note: put the semicolon on a separate line to silence this
          warning
    1 warning generated.

This is good! And it also works for "else if" cases. But I just did the same
bug and put a semicolon after a bare else:

    int main(int argc, char** argv) {
      if (argc > 4)
        return 1;
      else;  // <- Semicolon
        return 2;
      return 0;
    }

And there is no warning. This was pretty tricky to find and it seems like the
same rule for "if" semicolons should just also be applied to "else".</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>