[llvm-bugs] [Bug 28918] New: -Wunreachable-code warning involving templated local variable can't be suppressed with extra parentheses

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 9 13:00:49 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28918

            Bug ID: 28918
           Summary: -Wunreachable-code warning involving templated local
                    variable can't be suppressed with extra parentheses
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cpeterson at mozilla.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16922
  --> https://llvm.org/bugs/attachment.cgi?id=16922&action=edit
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] https://bugzilla.mozilla.org/show_bug.cgi?id=1223265
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1291397

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160809/dd5bc6bd/attachment.html>


More information about the llvm-bugs mailing list