<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 - break in statement expression results in -Wunreachable-code"
   href="https://bugs.llvm.org/show_bug.cgi?id=36075">36075</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>break in statement expression results in -Wunreachable-code
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>5.0
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code results in -Wunreachable-code on clang 5.0 and trunk:

--------------------------------

int main()
{
    while (true)
    {
        ({ break; });
    }
}

--------------------------------

prog.cc:5:9: warning: code will never be executed [-Wunreachable-code]
        ({ break; });
        ^~~~~~~~~~~~

--------------------------------

It seems the trigger is an unconditional "break" statement as the last one of
the expression statement.

The warning goes away after putting the expression statement inside a macro
which might be related to a fix for <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [linux kernel] -Wunused-value should not warn about unused statement expression result expanded from a macro"
   href="show_bug.cgi?id=13747">bug 13747</a>, but the warning shouldn't be
generated regardless.</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>