<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 8/6/16 9:50 AM, David Blaikie wrote:<br>
    </div>
    <blockquote
cite="mid:CAENS6Evp0d6GjRJjJRWF1Tpa_ZnAri3_ZHA63SPST_NSi6mvDA@mail.gmail.com"
      type="cite">
      <pre style="line-height:normal">Could you provide a small example that fails (warns/doesn't suppress) with 3.9/ToT but succeeds (successfully suppresses the warning) with earlier?</pre>
    </blockquote>
    <br>
    Thanks for testing, David. Below 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.<br>
    <br>
    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.<br>
    <br>
    I filed clang bug 28918 for this issue:<br>
    <br>
    <a class="moz-txt-link-freetext" href="https://llvm.org/bugs/show_bug.cgi?id=28918">https://llvm.org/bugs/show_bug.cgi?id=28918</a><br>
    <br>
    $ clang++ -Wunreachable-code test.cpp<br>
    test.cpp:23:5: warning: code will never be executed
    [-Wunreachable-code]<br>
        printf("Does clang warn about this code being unreachable?\n");<br>
        ^~~~~~<br>
    1 warning generated.<br>
    <br>
    thanks,<br>
    chris<br>
    <br>
    <br>
    // Compile me like so:<br>
    //   clang++ -Wunreachable-code test.cpp<br>
    // and see if I produce a build warning.<br>
    //<br>
    // Note that if you change aSomeVec to be a non-templated type, then<br>
    // the build warning goes away.<br>
    <br>
    #include "stdio.h"<br>
    #include <vector><br>
    <br>
    // Note: aSomeVec must be passed by value to trigger the problem, it
    seems.<br>
    // Changing to std::vector<int>& reference silences the
    warning.<br>
    static bool<br>
    FuncThatTakesATemplatedArg(std::vector<int> /* aSomeVec */)<br>
    {<br>
      return false;<br>
    }<br>
    <br>
    int main()<br>
    {<br>
      std::vector<int> myVec;<br>
      if ((false) &&<br>
          !FuncThatTakesATemplatedArg(myVec)) {<br>
        printf("Does clang warn about this code being unreachable?\n");<br>
        return 1;<br>
      }<br>
    <br>
      return 0;<br>
    }<br>
  </body>
</html>