<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - -Wunreachable-code warning involving templated local variable can't be suppressed with extra parentheses"
   href="https://llvm.org/bugs/show_bug.cgi?id=28918">28918</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-Wunreachable-code warning involving templated local variable can't be suppressed with extra parentheses
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>cpeterson@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16922" name="attach_16922" title="test.cpp">attachment 16922</a> <a href="attachment.cgi?id=16922&action=edit" title="test.cpp">[details]</a></span>
test.cpp

-Wunreachable-code warning involving templated local variable can't be
suppressed with extra parentheses. I suppressed a -Wunreachable-code warning in
Firefox earlier this year [1] by adding extra parentheses, as suggested by
Xcode's clang on OS X. Unfortunately, this Firefox warning is back [2] because
clang 3.9 on Linux no longer recognizes the parentheses suppression.

Attached is a standalone test case that reproduces the insuppressible warning
even with Xcode's clang (Apple LLVM version 7.3.0 (clang-703.0.31)). So there
is a latent clang bug plus a regression that caused Firefox's
previously-suppressible warning to no longer be suppressible.

The warning looks like it might only happen when the boolean condition involves
an expression with a templated type. In the test case below, a templated local
variable gets copy-constructed to form an argument to a boolean
helper-function.

$ clang++ -Wunreachable-code test.cpp
test.cpp:23:5: warning: code will never be executed [-Wunreachable-code]
    printf("Does clang warn about this code being unreachable?\n");
    ^~~~~~
1 warning generated.

[1] <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1223265">https://bugzilla.mozilla.org/show_bug.cgi?id=1223265</a>
[2] <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1291397">https://bugzilla.mozilla.org/show_bug.cgi?id=1291397</a></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>